#Run animation problem

1 messages · Page 1 of 1 (latest)

worn coyote
#

can anyone help me with my running script?, i put my script into startcharacterscript, then when I join i can see the run animation, but my friend can't, are there anyone who can help me with this issue? thanks

#

local UserInputService = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer

local sprintAnimId = "rbxassetid://137600647929370"
local sprintTrack = nil

UserInputService.InputBegan:Connect(function(input, processed)
if processed then return end
if input.KeyCode == Enum.KeyCode.LeftShift then
if Player.Character and Player.Character:FindFirstChild("Humanoid") then
Player.Character.Humanoid.WalkSpeed = 30

        local humanoid = Player.Character.Humanoid
        local anim = Instance.new("Animation")
        anim.AnimationId = sprintAnimId
        local animator = humanoid:FindFirstChildOfClass("Animator")
        if not animator then
            animator = Instance.new("Animator")
            animator.Parent = humanoid
        end
        sprintTrack = animator:LoadAnimation(anim)
        sprintTrack.Priority = Enum.AnimationPriority.Action
        sprintTrack:Play()
    end
end

end)

UserInputService.InputEnded:Connect(function(input, processed)
if processed then return end
if input.KeyCode == Enum.KeyCode.LeftShift then
if Player.Character and Player.Character:FindFirstChild("Humanoid") then
Player.Character.Humanoid.WalkSpeed = 16

        if sprintTrack then
            sprintTrack:Stop()
            sprintTrack = nil
        end
    end
end

end)