Walk Animation plays on every player when one player is moving

Essentially, when the player character moves, the custom walk animation plays, but when one player does the animation, every single player also starts doing the animation, no matter if they’re moving or not.

I’m unsure of a fix, as I am rusty with animation scripts specifically.

local model = script.Parent.Parent
local animationController = model.AnimationController
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:FindFirstChild("Humanoid")

local idle = animationController.Animator:LoadAnimation(script.Parent.Idle)
idle:Play()
idle.Priority = Enum.AnimationPriority.Idle
local walk = animationController.Animator:LoadAnimation(script.Parent.Walk)
walk.Priority = Enum.AnimationPriority.Movement

humanoid.Running:Connect(function(speed)
	walk:AdjustSpeed(speed / 8)
	if speed > 0 then
		if not walk.IsPlaying then
			walk:Play()
		end
		walk:AdjustSpeed(speed / 8)
	else
		if walk.IsPlaying then
			walk:Stop()
		end
	end
end)

Are you usuing one AnimationController for every character?
If so, then you need to create AnimationController for every character

the AnimationController should be separate, as the models are cloned to be separate on two different models

Could you show where your script located in Studio Explorer?


here is where the script is, it is called Script

Kind of lost me here..

ClientScript
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")

local idle = animator:LoadAnimation(script.Parent.Idle)
idle.Priority = Enum.AnimationPriority.Idle
idle:Play()

local walk = animator:LoadAnimation(script.Parent.Walk)
walk.Priority = Enum.AnimationPriority.Movement

humanoid.Running:Connect(function(speed)
	if speed > 0 then
		if idle.IsPlaying then idle:Stop() end
		if not walk.IsPlaying then walk:Play() end
		walk:AdjustSpeed(speed / 8)
	else
		if walk.IsPlaying then walk:Stop() end
		if not idle.IsPlaying then idle:Play() end
	end
end)

Hope this works out for you.. I also add a cleaner version to handle idle/walk switching automatically.

I think you should get AnimationController.Animator from player.Character or player.CharacterAdded:Wait()

@2112Jay posted the code for you, just change it on your things on his code

Actually, this is 100% hackable and would lead to a disaster in the game.
Easy to fix that part of it up too..

Client
-- LocalScript (StarterPlayerScripts)
local remote = game.ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("MoveUpdate")
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local humanoid = char:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
local idle = animator:LoadAnimation(script.Parent.Idle)
idle.Priority = Enum.AnimationPriority.Idle
idle:Play()
local walk = animator:LoadAnimation(script.Parent.Walk)
walk.Priority = Enum.AnimationPriority.Movement
humanoid.Running:Connect(function(speed)
	remote:FireServer(speed > 0)
	if speed > 0 then
		if idle.IsPlaying then idle:Stop() end
		if not walk.IsPlaying then walk:Play() end
	else
		if walk.IsPlaying then walk:Stop() end
		if not idle.IsPlaying then idle:Play() end
	end
end)
Server
-- ServerScript (ServerScriptService)
local rs = game.ReplicatedStorage
local remotes = rs:FindFirstChild("Remotes") or Instance.new("Folder", rs); remotes.Name = "Remotes"
local remote = remotes:FindFirstChild("MoveUpdate") or Instance.new("RemoteEvent", remotes); 
remote.Name = "MoveUpdate"
-- I know, funny. Just showing you.. you can make this manually and remove this part.

remote.OnServerEvent:Connect(function(player, moving)
	local char = player.Character
	if not char then return end
	local humanoid = char:FindFirstChild("Humanoid")
	if not humanoid then return end
	if moving then
		humanoid.WalkSpeed = 16
	else
		humanoid.WalkSpeed = 8
	end
end)

Super simple really.. The hackable parts get moved to the server. In this case it’s the speed change.

i need the model to play the animations, not the player directly, the model is controlled by the player

You’ll have to modify it to do that. Maybe put the animations where all the other animations are.
You have custom animations that are replacing the actual animations. The first thing I’d try is to just replace them where they are now.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.