local UserInputService = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
plr.CharacterAdded:Wait()
local animRun = Instance.new("Animation", script.Parent)
animRun.AnimationId = ""
local loadRun = plr.Character:WaitForChild("Humanoid"):LoadAnimation(animRun)
UserInputService.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift and plr.Character.Humanoid.MoveDirection.Magnitude > 0 and not plr.Character.Humanoid.Sit then
loadRun = plr.Character:WaitForChild("Humanoid"):LoadAnimation(animRun)
plr.Character.Humanoid.WalkSpeed = 35
if loadRun then
--loadRun:Play()
end
end
end)
plr.Character.Humanoid:GetPropertyChangedSignal("WalkSpeed"):Connect(function()
--loadRun:Stop()
end)
UserInputService.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift then
--loadRun:Stop()
plr.Character.Humanoid.WalkSpeed = 16
end
end)
When i switch weapons while running my character immediately halts and refuses to move for a few seconds.
I have been messing with pretty much everything until I found out that this will happen for any tool. How can I fix this?
I don’t know what would exactly is wrong, the only thing I can think of as of right now is using the animator that’s a child of the humanoid, use that instead for loading animations
I’m pretty sure that animator is created automatically so you wouldn’t have to worry about adding it, if it isn’t then just create an instance animator and parent it to the humanoid.
My bad. I currently only have 2 weapons in the game, and when I pressed shift+2 it would prompt me to change the Move increment and I didnt even notice. So there was nothing wrong with the script, whenever I pressed Shift+2 it stopped my character because Studio thought I wanted to change that property