Hello ! So Im Trying To Add A Cooldown By Using Debounce But I Dont Know How . I Want To Add A Cooldown For When I Open And Close The Curtains , Can Someone Help Me ?
V Script V
local ProximityPrompt = script.Parent.Interact.ProximityPrompt local CurtainL = script.Parent.CurtainL local CurtainR = script.Parent.CurtainR local ClosedCurtainL = script.Parent.ClosedCurtainL local ClosedCurtainR = script.Parent.ClosedCurtainR ProximityPrompt.Triggered:Connect(function() if ProximityPrompt.ActionText == "Open" then --the text is set to "Open" script.Parent.Sound:Play() CurtainL.Transparency = 0 CurtainR.Transparency = 0 -- the brightness off ClosedCurtainL.Transparency = 1 ClosedCurtainR.Transparency = 1 ProximityPrompt.ActionText = "Close" --text change to "Close" else script.Parent.Sound:Play() CurtainL.Transparency = 1-- the brightness on CurtainR.Transparency = 1 ClosedCurtainL.Transparency = 0 ClosedCurtainR.Transparency = 0 ProximityPrompt.ActionText = "Open" --text change to "Open" end end)
local ProximityPrompt = script.Parent.Interact.ProximityPrompt local CurtainL = script.Parent.CurtainL local CurtainR = script.Parent.CurtainR local ClosedCurtainL = script.Parent.ClosedCurtainL local ClosedCurtainR = script.Parent.ClosedCurtainR local debounce = false ProximityPrompt.Triggered:Connect(function() if debounce then return end debounce = true if ProximityPrompt.ActionText == "Open" then --the text is set to "Open" script.Parent.Sound:Play() CurtainL.Transparency = 0 CurtainR.Transparency = 0 -- the brightness off ClosedCurtainL.Transparency = 1 ClosedCurtainR.Transparency = 1 ProximityPrompt.ActionText = "Close" --text change to "Close" else script.Parent.Sound:Play() CurtainL.Transparency = 1-- the brightness on CurtainR.Transparency = 1 ClosedCurtainL.Transparency = 0 ClosedCurtainR.Transparency = 0 ProximityPrompt.ActionText = "Open" --text change to "Open" end wait(3) -- Change if needed debounce = false end)