How Do You Make This Script Work When You Press a Arrow Key? Script:
function OnKeyDown(key)
if (key == '') then
end
end
game.Players.LocalPlayer:GetMouse().KeyDown:connect(OnKeyDown)
Thank you!
How Do You Make This Script Work When You Press a Arrow Key? Script:
function OnKeyDown(key)
if (key == '') then
end
end
game.Players.LocalPlayer:GetMouse().KeyDown:connect(OnKeyDown)
Thank you!
In a LocalScript:
local UIS = game:GetService("UserInputService") -- What the UIS is, is basically an ear for anything the Users do. Such as: Press a key, Type in chat AND MUCH MUCH MOREEE!~
UIS.InputBegan:connect(function(input) -- If UIS has been fired
if input.UserInputType == Enum.UserInputType.Keyboard and input.UserInputState == Enum.UserInputState.Begin then -- If The user is using the keyboard, and Has pressed a key.
if input.Keycode == Enum.KeyCode.Down or input.Keycode == Enum.Keycode.Left or input.Keycode == Enum.Keycode.Right or input.Keycode == Enum.Keycode.Up then -- Checks for Left, Right, Up, or Down keys being pressed, if not, moves on.
-- CODE HERE :)
end
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
You can use string.byte(), but you need to get arrow key code.