I'm making a crouch script and it works fine for one player but if you have more, then any player can control the newest joined player. The animation will play only for this new player and nobody else. This is my script under ServerScriptService:
local walking = Instance.new("BoolValue") walking.Value = false local Players = game:GetService("Players") Players.PlayerAdded:Connect(function(player) wait(4) local Animation = Instance.new("Animation", player.Character) Animation.AnimationId = "rbxassetid://5010278985" Animate = player.Character.Humanoid:LoadAnimation(Animation) wait() local Animation2 = Instance.new("Animation", player.Character) Animation2.Name = "Animation2" Animation2.AnimationId = "rbxassetid://5062446283" Animate2 = player.Character.Humanoid:LoadAnimation(Animation2) end) game.ReplicatedStorage.Crouch.Start.OnServerEvent:Connect(function(player) if walking.Value == false then walking.Value = true Animate:Play() end end) game.ReplicatedStorage.Crouch.End.OnServerEvent:Connect(function(player) walking.Value = false Animate:Stop() Animate2:Stop() end) game.ReplicatedStorage.Crouch.Start.OnServerEvent:Connect(function(player) player.Character.Humanoid.Running:Connect(function(speed) if walking.Value == true and speed >= 1 then Animate:Stop() Animate2:Play() end end) end) game.ReplicatedStorage.Crouch.Start.OnServerEvent:Connect(function(player) player.Character.Humanoid.Running:Connect(function(speed) if speed <= 0 and walking.Value == true then Animate2:Stop() Animate:Play() end end) end)
Instead of Animate:Play() or Animate:Stop() using my created animations is there a way to do
player.Character.Animate:Play()
I've just recently got into animations so any help is appreciated.
The problem is that the Animator instance on the humanoid automatically controls the synchronisation of your animation. You can try to create a different animator instance and attempt to load the animation onto that new animator instance. Note that you must do is on the client so that the animator instance won't replicate back to the server!
https://devforum.roblox.com/t/how-do-i-make-an-animation-just-play-on-the-client/76039/2
Oh I see your problem ServerScriptService - is for the whole server to see local - only you to see or you could choose someone else
If this helps please consider an upvote. Greatly Appreciated ????
I have seen someone on youtube make a n animation that plays using a plugin. I hope this helps???