So basically, I'm trying to make it so when a button is pressed, the smoke turns on, That part works, however, I'm trying to make it so you can disable it with a debounce. If you can, please help.
local enabled = false
local debounce = false
local Model = script.Parent.Parent.Parent.gas
script.Parent.ClickDetector.MouseClick:Connect(function()
for i,v in pairs (Model:GetChildren()) do
if not debounce then
if enabled == false then
v.Smoke.Enabled = true
wait(3)
debounce = false
if v.Smoke.Enabled == true then
v.Smoke.Enabled = false
end
end
end
end
end)

1 comment
this is better, it actually explains it!