Answered by
pwx 1581
4 years ago Edited 4 years ago
Rather than destroying the click detector, what I'd do is make it a variable and parent it elsewhere until you need to use it again.
01 | local clickDetector = script.Parent.ClickDetector |
03 | clickDetector.MouseClick:Connect(player) |
04 | script.Parent.Transparency = 1 |
05 | script.Parent.CanCollide = false |
06 | clickDetector.Parent = game.ServerStorage |
08 | script.Parent.Transparency = 0 |
09 | script.Parent.CanCollide = true |
10 | clickDetector.Parent = script.Parent |
Obviously you can parent it where ever you need but in hindsight I feel it's a lot easier than destroying it and then creating a new one.