currently, animations are not working as intended. i have a localscript that, upon pressing the “C” key, allows players to crouch. this changes the ID of their default walking animation. upon pressing the “C” key again, they uncrouch, and their animations return to normal. however, on other clients’ screens, the player continues to play the crawling in place animation, and i’m unsure how to fix it. would i have to go about playing animations a different way than just changing the ID of the default animations themselves, or can i keep my method with a workaround? script can be provided if necessary. thank you!
I’m not exactly familiar with switching IDs of playing animation, but here are a few solutions I thought of after reading this topic:
- Have you tried stopping the animation before switching IDs, and playing it once the ID has been switched?
- Instead of switching the IDs, have a crouching and walking ID and just play/stop those when necessary?
If you play animations on a local script, they only appear on that player’s screen, it is client sided
If you want to replicate them, you would need to have them occur on a server script
Check out this article
The script would be something like this
server script
local RF = Instance.new('RemoteFunction',game.ReplicatedStorage)
RF.Name = 'AnimationEvent'
RF.OnServerEvent:Connect(function(player, animation)
player.Character.Humanoid:LoadAnimation(animation)
end)
client
--key .pressed whatever (whatever your event is)
mouse.key.C.Pressed:Connect(function()
game.ReplicatedStorage:WaitForChild('AnimationEvent'):FireServer(script.Animation)
end)
something like that
hi, this is not the case. i’ve already done searching and any animations and movement performed underneath a player-owned character are replicated across all clients. the animations are playing, it’s just that they’re not matching from one client to the others.
this is what i will attempt to do soon. if this works, i’ll mark yours as a solution.
Load the animation from clientside
i already do that. it’s a localscript. please read.
This is an error of priority. I actually ran into this error not long ago. You can can correct this by opening your animations in the Animation Editor, click Edit and increase the priority past “core”. All default animations are set at “core”.
It’s also worth noting that animations replicate automatically. But, in order for it to do so, the Animator object has to be a child of Humanoid
. This happens automatically if you’re using the default player.
Hope this helps!