I made this code which destroys a Clickdetector in the scripts parent and then clones the Clickdetector but the destroying part works but not the cloning part to then create back the clickdetector.
My Code:
1 | local click = script.Parent.ClickDetector --or wherever it is |
2 |
3 | click.MouseClick:Connect( function (player) |
4 | script.Parent.ClickDetector:Destroy() |
5 | wait( 20 ) |
6 | script.Parent.ClickDetector:Clone() |
7 | end ) |
Thank You and Help is Appreciated
1 | local click = script.Parent.ClickDetector --or wherever it is* |
2 | local Cloned = click:Clone() |
3 |
4 | click.MouseClick:Connect( function (player) |
5 | Cloned.Parent = game.Workspace --This put the "Clone" of "click" in the Workspace |
6 | click:Destroy() |
7 | wait( 20 ) |
8 | Cloned.Parent = script.Parent |
9 | end ) |
I haven't try that script but it should work.
01 | local click = script.Parent.ClickDetector |
02 |
03 | click.MouseClick:Connect( function (player) |
04 | local ClickClone = click:Clone() |
05 | ClickClone.Parent = game.ReplicatedStorage |
06 | click:Destroy() |
07 |
08 | wait( 20 ) |
09 |
10 | ClickClone.Parent = script.Parent |
11 | end ) |
12 |
13 | -- Bingo Bongo. |