im playing an animation on the client for a tool, but im handling everything else on server
if i wanna use GetMarkerReachedSignal on the server, how would i go about doing that?
i tried using a remotefunction to send from to server to client to play the animation then return the animation from client to server but it says the anim is nil on server
#help with getting markerreached on server from anim playing on client
1 messages · Page 1 of 1 (latest)
on server:
on client:
remotefunction setup didnt work so im just wondering what i should do now
just catch the event on the client and make it send a remote event to the server to do whatever you want
the issue is
im making a weapon and most stuff is handled on server
so to play an animation i send a remoteevent from server to client to play the animation but i cant really do getmarkerreachedsignal that way unless i make it check the animation on client but i dont wanna just have a bunch of elseifs on client that fire back to server
if having a bunch of elseifs is the only way to do it then ig ill do that but i feel like theres a more convenient way to go about this
??????????
why are you asking that here
LOL
isnt it all same ?
no bro
mb bro
yeah im not sure ngl, I've never handled animations this way
i see
ill wait to see if anyone else responds and if not ill have to bite the bullet and just do a bunch of checks
thanks for the help nonetheless
it would but
theres gonna be like
a ton of different anims
LOL WHAT WAS THAT
uhhhhhh
** You are now Level 5! **
so i dont wanna have a bunch of checks for which anim is playing like
if anim = "Tyrant Revolver" then
elseif anim = "Slam" then
etc etc
end
but if thats my only option ill just have to do it
you dont need checks
the animation event is seen across all client scripts
you dont need to check if the animation is playing
if the event fires then it will be recieved in the getmarkerreached
im not checking if its playing i need to check the specific animation
since ill be sending different ones through
🤨
if i just put general stuff for every animation through it would check for markers that dont exist
like right now im just checking for the Knee marker for an anim called TyrantRevolver, but what if i send a different animation to client which doesnt have a knee marker
then you handle it differently 👍🏽
exactly thats what im trying to do
your animation setup is just unique, maybe roblox studio guru come here and know what you're talking about
ig
generally speaking you should be playing animations on the client, unless you have some specific framework where you dont want that
ya i am playing anims on the client thats why this entire problem is happening lol
bro
i fire something from server to signal to client to play the anim
right..
so then you just need to check for getmarkerreached and the specific event name
you dont need else ifs
you dont need to check what animation is playing
😭
thats the problem im sending multiple different animations through the event
am I crazy
not just a single one
ohh
so you have multiple animations with the same event name, but you want each animation to do different things?
if that's the case then yeah you would need to check which one is playing. but I would not recommend this, just use a different event name for each animation.
my tip for you is handle animations clientsidedly (bonus: they have no replication delay) and validate the marker event on the server (exploiters can spoof remote events on the client)
example scripts (off of dev forum):
-- local script insideof a tool
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local tool = script.Parent
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://YOUR_ANIMATION_ID"
local animationTrack
tool.Activated:Connect(function()
local character = player.Character
if not character then return end
local humanoid = character:FindFirstChildOfClass("Humanoid")
if not humanoid then return end
animationTrack = humanoid:LoadAnimation(animation)
animationTrack:Play()
animationTrack:GetMarkerReachedSignal("YourMarkerName"):Connect(function(param)
game.ReplicatedStorage.AnimationMarkerFired:FireServer("YourMarkerName", param)
end)
end)
-- serversided script to handle the marker
game.ReplicatedStorage.AnimationMarkerFired.OnServerEvent:Connect(function(player, markerName, param)
if markerName == "YourMarkerName" then
print(player.Name .. " reached animation marker: " .. markerName)
-- do the logic here
end
end)
the animations are for different attacks
so im sending the animation through a remoteevent to play that animation
on server it just fires the animation and on client it plays the animation
they dont have the same event name, its just that different animations are getting sent through the same remoteevent
** You are now Level 10! **
yeah idk 🐧
issue is with my setup i cant just do everything on client
the main attacks are on server and stuff so to play the animations i send a remoteevent from server to client which makes the animation play on client
theres only 1 remoteevent, and im sending different animations through it
so is there a way to detect the markerreached on server since i know the specific animation on server? or will i just have to put a bunch of checks to see which animation was sent to client and do getmarkerreachedsignal accordingly
I dont know about your problem specifically but your setup overall doesnt seem ideal. you want attacks to take place on the client, but then verify the attacks on the server
handling attacks on the server and sending animations via remote event will not feel responsive
there is a noticable delay
my setup detects the actual input for the attack on client and does the actual thing on server
yeah the only way is to handle marker detection on the client and tell the server when a marker is reached via your current remote event
the server can’t verify the client and even if it did it would pose security risks because of exploiters
alright ill just have to do checks then