local assetID = 02236125916
local MaxDistance = 25
debounce = false
function onKeyPress(inputOject, gameProcessedEvent)
if inputObject.Keycode == Enum.KeyCode.R then
game:GetService("InsertService"):LoadAsset(02236125916).Parent = game.Workspace.Model
if debounce == false then
debounce = true
if game:GetService("UserInputService").InputEnded then
if debounce == false then
debounce = true
game.Workspace["BB GUI"].BillboardGUI.Enabled = false
wait(1)
debounce = false
end
end
end
end
game:GetService("UserInputService").InputBegan:connect(onKeyPress)
I think I might have put the debounce codes in the wrong place, please help!

5 comments
Are you gonna use the 'else' statement or no? If no, or waits?
@cherrythetree Could you post an example. Also if you could add in a part where you can only use the R key from a certain distance that would be nice!
InsertService is server-side only. I recommend using a RemoteEvent.!
Btw, if there is assetId then why are you not using it to line 07? And you forgot local in debounce. And I think I will agree incapaz but InsertService can give assets thought.
If my answer satisfies your question, please accept it.