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

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

Asked by 3 years ago

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
It should be KeyCode not Keycode; Lua is case sensitive. JesseSong 3916 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

Your Keycode is suppose to be KeyCode so its

if key.KeyCode == Enum.KeyCode.LeftShift
Ad

Answer this question