Animation not sometimes playing on other player

i made a local script sprint system the animation play fine on the player view but in other players the animation sometimes dont play.

Example:

Script:

local plr = game.Players.LocalPlayer
local UserInput =  game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local tween = game:GetService("TweenService")
local Running = plr.Character.Running

local WalkValue = plr.Character.WalkValue.Value
local RunValue = plr.Character.RunValue.Value


local RunningAnim = plr.Character.Humanoid:LoadAnimation(script.RunningAnim)
local runningstart = tween:Create(plr.Character.Humanoid, TweenInfo.new(1), {WalkSpeed = RunValue})

local animspeed = plr.Character.RunningAnimSpeed
local valueee = 1

local RunAdjust = tween:Create(animspeed, TweenInfo.new(1),{Value = valueee})

UserInput.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.LeftShift and plr.Character.Attacking.Value == false and plr.Character.Dead.Value == false and plr.Character.Finished.Value == false and plr.Character.Finisher.Value == false then
		Running.Value = true
		RunAdjust:Play()
		runningstart:Play()
	end
end)

UserInput.InputEnded:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.LeftShift  and plr.Character.Attacking.Value == false and plr.Character.Dead.Value == false and plr.Character.Finished.Value == false and plr.Character.Finisher.Value == false then
		Running.Value = false
		runningstart:Cancel()
		RunAdjust:Cancel()
		animspeed.Value = 0.3
		plr.Character.Humanoid.WalkSpeed = WalkValue
	end
end)

plr.Character.Humanoid.Running:Connect(function(speed)
if speed > 0 then
		if not RunningAnim.IsPlaying and Running.Value == true then
			RunningAnim:Play()
		elseif RunningAnim.IsPlaying and Running.Value == false then
			RunningAnim:Stop()
		end
        elseif RunningAnim.IsPlaying then
	        RunningAnim:Stop()
	end
end)

RunService.RenderStepped:Connect(function()
	RunningAnim:AdjustSpeed(plr.Character.RunningAnimSpeed.Value)
end)

1 Like

it could be that you uploaded the animation to the wrong owner.

basically, you would want to set the creator of the animation to the group when uploading the animation. if it’s not a group game, make sure that you are the creator, and that you didn’t set the owner of the animation to your group.

also, it could also be that you inputted the animation ID wrong. try re-uploading the animation and get the correct id.

also, here there’s an error because you need to have “elseif” before end. it should look like this:

plr.Character.Humanoid.Running:Connect(function(speed)
	if speed > 0 then
		if not RunningAnim.IsPlaying and Running.Value == true then
			RunningAnim:Play()
		elseif RunningAnim.IsPlaying and Running.Value == false then
			RunningAnim:Stop()
		elseif RunningAnim.IsPlaying then
	       	RunningAnim:Stop()
		end
	end
end)

it could also be something else. if there are any errors and/or everything above fails, let me know. I’d be very happy to help.

1 Like

i already found a solution i just have to

local Running = plr.Character.Running

instead of

local Running = plr.Character.Running.Value

i appreciate your help.