Please, test the attached project before.
Could anyone run this project and tell me why PageUp and PageDown are not being detected?
game.rbxl (25.9 KB)
I think the page up and down keys are being used for scrolling the camera by core scripts, try using ContextActionService and create a binding with a higher priority if all else fails:
local ContextActionService = game:GetService("ContextActionService")
local function handler()
print('Key Pressed!')
return Enum.ContextActionResult.Sink
end
ContextActionService:BindActionAtPriority('Event', handler, false,
Enum.ContextActionPriority.High.Value, Enum.KeyCode.PageUp, Enum.KeyCode.PageDown)
For me, going into a blank baseplate, the keys aren’t being detected with the script you provided. This could be a new addition–but typing Enum.KeyCode.PageDown
into the “find all” window, shows that they are being bound to the action "RbxSettingsScrollHotkey"
.
Edit: testing again however I do notice that it only happens in studio and not in game, and exploring a little more it seems that this might be caused solely by studio shortcuts:
Actually that gives me an idea. Good find, I didn’t think about Studio shortcuts. If it wasn’t a factor from the game itself and there was no ActionBinding on the PageUp/PageDown keys then the only other option is that the Studio window is capturing input on these keys. Somewhere, these keys have precedence and sink other inputs.
@rogeriodec_games The input keys still check fine for me in your new files as well. Just checking here, but do you have Studio still respect shortcuts while in a playtesting mode? You will need to uncheck this box in your settings and restart Studio so that Studio keys aren’t being detected while testing with the viewport focused.
You solved the riddle!
Thank you very much!