Not sure what I did wrong but it isn't working and I need help.
local player = game.Players.LocalPlayer local Character = player.Character or script.Parent local humanoid = player.Character.Humanoid local Humanoid = Character.Humanoid local UIS = game:GetService("UserInputService")
local AnimationId = 'rbxassetid://6267230901'
UIS.InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.LeftShift then if player.Character ~= nil then
while player.Character.Humanoid.WalkSpeed >= 50 do wait() local Animation = Instance.new("Animation") Animation.AnimationId = AnimationId local LoadAnimation = Humanoid:LoadAnimation(Animation) LoadAnimation:Play() end end end
end)
UIS.InputEnded:Connect(function(input) if input.KeyCode == Enum.KeyCode.LeftShift then if player.Character ~= nil then player.Character.Humanoid.WalkSpeed = 16
while player.Character.Humanoid.WalkSpeed <= 16 do wait() local Animation = Instance.new("Animation") Animation.AnimationId = AnimationId local LoadAnimation = Humanoid:LoadAnimation(Animation) LoadAnimation:Stop() end end end
end)