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!
local assetID, MaxDistance, debounce = 02236125916, 25, false function onKeyPress(inputObject, gameProcessedEvent) --You spelled 'inputObject' incorrectly. I fixed it. if inputObject.Keycode == Enum.KeyCode.R and debounce == false then debounce = true game:GetService("InsertService"):LoadAsset(02236125916).Parent = game.Workspace.Model while true do wait() if game:GetService("UserInputService").InputEnded then game.Workspace["BB GUI"].BillboardGUI.Enabled = false wait(1) break end end end debounce = false end game:GetService("UserInputService").InputBegan:connect(onKeyPress)