local debounce = true
script.Parent.Touched:connect(function(part)
local h = part.Parent:FindFirstChild("Humanoid")
if h ~= nil and debounce == true then
wait()
game.ServerStorage.t1:Clone().Parent = game.Workspace
script.Parent.p:Play()
local tp1 = game.Workspace.t1
wait()
script.Parent.BrickColor = BrickColor.new("Black")
debounce = false
--[[The following lines are optional in case you want a timer for a button to reactivate.
wait(5) --Cooldown time. Can be changed to anything depending on what you want.
script.Parent.BrickColor = BrickColor.new("Really blue") --Change the color to whatever you
--want.
debounce == true --This re-enables the script. Don't mess with this unless you want to break
--the script.
--]]
end
end)
Sorry for the slightly messy code. Basically, I want this button to disable itself after you touch it WITHOUT disabling the script, because I want a "cooldown" time for scenarios later in my game. I would very much appreciate assistance on this, as I am not too sure how debouncing works. Thank you!

1 comment
A tip, for a short cut. Instead of debounce == true, just do debounce by itself since debounce means true so it will run.