Hi, I made a sprint script and tried to make an animation play when I press shift. Only problem is, it won't play. I tried adjusting the priority and put it in different parts of the script but it doesn't work.
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://2510238627"
local plr = game:GetService("Players").LocalPlayer
local mouse = plr:GetMouse()
local char = plr.Character or plr.CharacterAdded:Wait()
local human = char:WaitForChild("Humanoid")
local track = human:LoadAnimation(anim)
track.Priority = Enum.AnimationPriority.Action
mouse.KeyDown:Connect(function(k)
if k:lower():byte() == 48 then
track:Play()
human.WalkSpeed = 23
end
end)
mouse.KeyUp:Connect(function(k)
if k:lower():byte() == 48 then
track:Stop()
human.WalkSpeed = 16
end
end)

5 comments
It works, but my animation doesn't change. It's supposed to change my walking animation to the animation in the script.
If it matters I'm using the werewolf run animation
Try setting the animation's priority inside the animation editor.
Nevermind, the animation ID was incorrect.
oof