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

I want this local script to Insert a click detector in EVERY brick via workspace?

Asked by 5 years ago

I'm very new to scripting, I'm working on a tool that inserts a click detector in every brick locally. (So every brick I can click.) This is what I only have so far.

script.Parent.Equipped:Connect(function()
    game.Workspace:GetChildren()
end)

Any help would be appreciated, thanks!

1 answer

Log in to vote
-2
Answered by 5 years ago
Edited 5 years ago
script.Parent.Equipped:Connect(function() -- Whenever the tool is equipped this will fire/
    for _,v in pairs(workspace:GetChildren()) do -- Get everything is workspace.
        local cd = Instance.new("ClickDetector") -- Make a new item *click detector*
        cd.Parent = v -- Put the item in all items that are in workspace *v*
        cd.Name = "Click" -- Rename the item to "Click"
    end
end)
1
No explanation was given. -1 User#24403 69 — 5y
0
Well. What do you want me to explain? He said give me a script that puts a click detector in ever brick. namespace25 594 — 5y
1
but he did explain SimSimYTOG -53 — 5y
Ad

Answer this question