Hello everyone!
So I am trying to get a script work that lets a player animation change when their walkspeed is above 18, but the script isn’t working. I also don’t see any errors in the output.
The script:
local id = "10679726519"
local player = game.Players.LocalPlayer
local humanoid = player.Character.Humanoid
local animation = Instance.new("Animation")
animation.Name = "Sprint"
animation.AnimationId = "rbxassetid://" .. id
local animationTrack = humanoid:LoadAnimation(animation)
local id2 = "10862905619"
local animation2 = Instance.new("Animation")
animation2.Name = "Walk"
animation2.AnimationId = "rbxassetid://" .. id2
local animationTrack2 = humanoid:LoadAnimation(animation2)
local function update()
if player.character.humanoid.WalkSpeed >= 18 then
animationTrack:Play()
elseif player.character.humanoid.WalkSpeed <= 18 then
animationTrack2:Play()
end
end
How can I fix this?