Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i change animation when shift is pressed / player is running?

Asked by 4 years ago

So i have this code atm


local InputService = game:GetService("UserInputService") local Players = game:GetService("Players") local walkspeed = 16 local RunningSpeed = 32 local player = Players.LocalPlayer local function Sprint(input, gameProcessed) if not gameProcessed then if input.UserInputType == Enum.UserInputType.Keyboard then local keycode = input.KeyCode if keycode == Enum.KeyCode.LeftShift then player.Character.Humanoid.WalkSpeed = RunningSpeed player.Character.Animate.run.RunAnim.AnimationId = "rbxassetid://658830056" end end end end local function StopSprint(input, gameProcessed) if not gameProcessed then if input.UserInputType == Enum.UserInputType.Keyboard then local keycode = input.KeyCode if keycode == Enum.KeyCode.LeftShift then player.Character.Humanoid.WalkSpeed = walkspeed player.Character.Animate.run.RunAnim.AnimationId = "rbxassetid://2510238627" end end end end InputService.InputBegan:Connect(Sprint) InputService.InputEnded:Connect(StopSprint)

Now i want the run animation to be the ninja running when sprinting and then go back to rthro running. Now this code doesnt work? Any help <3

0
Can you show the error? Plus is this a localScript? Gabe_elvin1226aclan 323 — 4y
0
Gabe theres not errors, yes this is a localscript minerleodark 0 — 4y

Answer this question