Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer
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)

3 comments

1

No explanation was given. -1

0

Well. What do you want me to explain? He said give me a script that puts a click detector in ever brick.

1

but he did explain

This discussion is preserved as it was. New answers, comments, and votes are closed.