Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

im getting the message "keyCode is not a valid member of Enum" how do i fix this?

im really inexperienced so it would be great if someone helped and walked my through this!

local UserInputService = game:GetService("UserInputService")
local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local isRunning = false

UserInputService.InputBegan:Connect(function(key)
	if key.KeyCode == Enum.Keycode.LeftShift then
		if not isRunning then
			isRunning = true
			Humanoid.Walkspeed = 32
		else
			Humanoid.Walkspeed = 16
			isRunning = false
		end
	end
end)

(not mine)

1 comment

1

It should be KeyCode not Keycode; Lua is case sensitive.

1 answer

Your Keycode is suppose to be KeyCode so its

if key.KeyCode == Enum.KeyCode.LeftShift

This discussion is preserved as it was. New answers, comments, and votes are closed.