Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

I made this code which destroys a click detector and then creates it. Am I right?

Asked by 7 years ago

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:

1local click = script.Parent.ClickDetector --or wherever it is
2 
3click.MouseClick:Connect(function(player)
4     script.Parent.ClickDetector:Destroy()
5     wait(20)
6     script.Parent.ClickDetector:Clone()
7end)

Thank You and Help is Appreciated

0
u cant clone smth that has been destroyed iddash 45 — 7y
0
bro i answered your last question an hour ago Gey4Jesus69 2705 — 7y
1
jesus you have less than half a brain. Elixcore 1337 — 7y
0
@gioni01 your code didnt work aspiringstar346 8 — 7y
View all comments (2 more)
0
You destroyed the clickdetector so you cannot clone something that is destroyed. IIApexGamerII 76 — 7y
0
Why would you even want to do this? T0XN 276 — 7y

2 answers

Log in to vote
1
Answered by 7 years ago
1local click = script.Parent.ClickDetector --or wherever it is*
2local Cloned = click:Clone()
3 
4click.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
9end)

I haven't try that script but it should work.

0
i think it's better if he clone the button when clicked caipira 29 — 7y
Ad
Log in to vote
0
Answered by 7 years ago
Edited 7 years ago
01local 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.

Answer this question