How do I make a curtain open and close with one button with debounce?
Asked by
5 years ago Edited 5 years ago
Yet again, still making my border game, but this time its like a scanning feature.
You press the scan button
The curtain closes
You wait 4 seconds.
The curtain opens.
Heres my script, I attempted it myself, but it broke the whole script, so it doesnt make me say anything or doesnt play the sound.
01 | local LastNext = tick() |
02 | script.Parent.ClickDetector.MouseClick:connect( function (Player) |
03 | if ( not Player.Team or Player.Team.Name = = 'Admission' ) and tick()-LastNext > 3 then |
04 | workspace:WaitForChild( 'BoothSFX' ).Talk:Play() |
05 | game:GetService( "Chat" ):Chat(Player.Character, 'Please face the scanner.' , 'White' ) |
07 | script.Parent.Parent.curtain.CanCollide = true |
08 | script.Parent.Parent.curtain.Transparency = 0 |
10 | script.Parent.Parent.curtain.CanCollide = false |
11 | script.Parent.Parent.curtain.Transparency = 1 |
Can anyone help? (note that the button is called "Scan" in workspace, and curtain is called "curtain", they are GROUPED.)