Sprint script not working due to strange cause

Walkspeed is not a valid member of Humanoid – What the Output said.

code:

local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")

local player = game.Players.LocalPlayer
local character  = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")

local camera = game.Workspace.Camera

UserInputService.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.LeftShift then
		if humanoid then
			humanoid.Walkspeed = 30

		end
	end
end)

UserInputService.InputEnded:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.LeftShift then
		humanoid.Walkspeed = 18
	end
end)

I do not know why this is happening.

1 Like

Is this a local script or a server script? You cannot get the player from a serverscript.

Be careful of your capitalization. It should be spelled WalkSpeed.

1 Like

Nvm, as the user above me said, you typed Walkspeed, but it should be WalkSpeed.

1 Like

this is a localscript.

AAAAAAAAAAA

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.