I tested the code ingame and it seems like to me it isn't reading when R is pressed.
function onKeyPress(inputObject, gameProcessedEvent) if inputObject.KeyCode == Enum.KeyCode.R and highlightstick == false then if not game:GetService("MarketplaceService"):UserOwnsGamePassAsync(a.UserId,5815263) and a.Name~="Player1" then game:GetService("MarketplaceService"):PromptGamePassPurchase(a,5815263) else highlightstick = true script.Parent.Size = script.Parent.Size.Vector3.new(0,0,0) print("worked") wait(2) highlightstick = false script.Parent.Size = script.Parent.Size.Vector3.new(2,4,2) print("worked1") end end end game:GetService("UserInputService").InputBegan:connect(onKeyPress)
Hey! I'm BlackOrange and I will be helping you today!
You are copying and pasting the code from the Roblox wiki website which may or may not be compatible.
Using a local script:
local UIS = game:GetService('UserInputService') UIS.InputBegan:Connect(function(Input, IsTyping) if IsTyping then return end if Input.KeyCode == Enum.KeyCode.R then print('R has been pressed!') end end)
Now all you have to do is put the code that you wish to use under the print.
Hopefully, this helped.
Best of luck developer!
BlackOrange3343