If you want it to be unclickable while in-between opening and closing, this is the best way to do it.
Before checking if it's "on" or vice versa, it will check if debounce is false. If true, then that means it's still running code and can't be used.
Here's how it should look. Hope this helps!
02 | script.Parent.Visible = true |
04 | local frame = script.Parent.Parent.Parent:WaitForChild( 'First' ) |
08 | local char = game.Players.LocalPlayer.Character.Humanoid |
10 | local cam = workspace.Camera |
11 | local int = require(game.ReplicatedStorage.Interpolate) |
13 | script.Parent.MouseButton 1 Click:connect( function () |
17 | game.ReplicatedStorage.Sounds.Click:Play() |
18 | frame:TweenPosition(UDim 2. new( 0 , - 500 , 0.5 , - 173 ), "In" , "Quad" ,. 5 , true ) |
19 | cam.CameraType = "Custom" |
23 | cam.CameraType = "Scriptable" |
24 | int.Interpolate(cam,CFrame.new( 6.75 , 78.302 , 0.25 ), CFrame.new( 0 , 78 , 0 ), "InOut" , "Quart" , 1 ) |
25 | game.ReplicatedStorage.Sounds.Click:Play() |
26 | frame:TweenPosition(UDim 2. new( 0 , 0 , 0.5 , - 173 ), "Out" , "Quad" ,. 5 , true ) |