I am having a bit of difficulty with checking for keypresses, I have some code that is supposed to check for a keypress every tick, but I am not sure how to check for the actual keypress:
function onKeyPress(actionName, userInputState, inputObject) print("R has been pressed") end game.ContextActionService:BindAction("keyPress",onKeyPress, false, Enum.KeyCode.R) runService.RenderStepped:connect(function() -- update every 1/60 of a second if [not sure what to do here] then --do something end end)
Also a mini question here, is there any way to program everything instead of using small scripts everywhere?
no need for while true do
do this
local uis = game:GetService("UserInputService") uis.InputBegan:Connect(function(Input, IsTyping) if Input.KeyCode == Enum.KeyCode.R and not IsTyping then -- do stuff end end)