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)