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

2 comments

0

Can you show the error? Plus is this a localScript?

0

Gabe theres not errors, yes this is a localscript