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

KeyCode isnt a valid EnumItem?

Asked by
proo34 41
4 years ago
local Players = game.Players.LocalPlayer
local Character = Players.Character
local UserInputService = game:GetService("UserInputService")

--16 is walk speed
--20 is running speed
local CurrentSpeed = 20

UserInputService.InputBegan:Connect(function(key)
    if key.KeyCode == Enum.KeyCode.KeyCode.LeftShift then
        Character.Humanoid.WalkSpeed = CurrentSpeed
    end
end)

UserInputService.InputEnded:Connect(function(key)
    if key.KeyCode == Enum.KeyCode.KeyCode.LeftShift then
        Character.Humanoid.WalkSpeed = 16
    end
end)

This script saids "KeyCode is not a valid EnumItem"

Thanks for the help!

1
I believe you just have to change ‘Enum.KeyCode.KeyCode.LeftShift’ to ‘Enum.KeyCode.LeftShift. It should work XviperIink 428 — 4y
0
Ha thats funny! Thanks proo34 41 — 4y

Answer this question