I have a gui button that when pressed changes the local players walk/run/idle animations as well as change the walk speed to 6.5. How would i disable shift to sprint while the animation is toggled on? I tried disabling the Sprint script within the animation script but you can still press shift and it makes the animation play too fast and it looks weird. Animate script
local player = game.Players.LocalPlayer
local humanoid = player.Character:WaitForChild('Humanoid')
local char = player.Character
script.Parent.MouseButton1Click:connect(function()
char.Humanoid.WalkSpeed = 6.5
char.Animate.walk.WalkAnim.AnimationId = "rbxassetid://3670529036"
char.Animate.run.RunAnim.AnimationId = "rbxassetid://3670529036"
char.Animate.idle.IdleAnim.AnimationId = "rbxassetid://3670529036"
end)
sprint
local Player = game.Players.LocalPlayer
local Character = Player.Character
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.LeftShift then
Character.Humanoid.WalkSpeed = 35
end
end)
UserInputService.InputEnded:Connect(function(key)
if key.KeyCode == Enum.KeyCode.LeftShift then
Character.Humanoid.WalkSpeed = 18
end
end)

1 comment
thanks i just added a bool value parented to the sprint script instead of using instance.new and it works now