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 6 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:

local click = script.Parent.ClickDetector --or wherever it is

click.MouseClick:Connect(function(player)
     script.Parent.ClickDetector:Destroy()
     wait(20)
     script.Parent.ClickDetector:Clone()
end)

Thank You and Help is Appreciated

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

2 answers

Log in to vote
1
Answered by 6 years ago
local click = script.Parent.ClickDetector --or wherever it is*
local Cloned = click:Clone()

click.MouseClick:Connect(function(player)
     Cloned.Parent = game.Workspace --This put the "Clone" of "click" in the Workspace
     click:Destroy()
     wait(20)
     Cloned.Parent = script.Parent
end)

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 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago
local click = script.Parent.ClickDetector

    click.MouseClick:Connect(function(player)
                local ClickClone = click:Clone()
            ClickClone.Parent = game.ReplicatedStorage
            click:Destroy()

            wait(20)

            ClickClone.Parent = script.Parent
    end)

    -- Bingo Bongo.

Answer this question