Im trying to Change the Animation of a Player after their humanoid speed changes, im making a Sonic Game currently, Cant seem to get the animations to the player neither change its animations when its humanoid walkspeed changes
Script:
game.Players.PlayerAdded:Connect(function(player)
local player = game.Players.LocalPlayer:GetCharacterFromPlayer()
local Humanoid = player:FindFirstChild(“Humanoid”)
local Animations = script.AnimationController:Clone()
local WalkAnimation = script.AnimationController.Walk:Clone()
local RunAnimation = script.AnimationController.Running:Clone()
local SprintAnimation = script.AnimationController.Sprinting:Clone()
if Humanoid then
Animations.Parent = Humanoid.Parent
print(“Animations Added”)
WalkAnimation.Parent = Animations
RunAnimation.Parent = Animations
SprintAnimation.Parent = Animations
else
print(“No Humanoid Detected”)
end
if Humanoid.Walkspeed == 20 then
WalkAnimation:Play()
SprintAnimation:Stop()
RunAnimation:Stop()
else
WalkAnimation:Stop()
end
if Humanoid.Walkspeed == 35 then
WalkAnimation:Stop()
SprintAnimation:Stop()
RunAnimation:Play()
end
if Humanoid.Walkspeed == 50 then
SprintAnimation:Play()
WalkAnimation:Stop()
RunAnimation:Stop()
end
end)
Scripts in Serverscript Service btw