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

Add a selectionbox

How can I add a selectionbox to whatever touches a brick?

function onTouched(hit).

Instance.new("SelectionBox").Parent = hit
end

script.Parent.Touched:connect(onTouched)

2 answers

✓ Accepted answer

What part?

workspace.Part.Touched:connect(function(hit)
	
	c = Instance.new("SelectionBox", hit)
	c.Adornee = hit
	
end)

Also, You've got to set the Adornee.

1 comment

0

Thanks.

SelectionBoxes have these things called "Adornees". It doesn't matter where the actual SelectionBox is, it only matters what it's adornee is. All you actually need to do is add 1 more line that to set it's Adornee to that part.

Here's the script I made like last year when I was trying to use SelectionBoxes.

function Boxify(Part)
	local Box = Instance.new("SelectionBox",Part)
	Box.Adornee = Part
end)

script.Parent.Touched:connect(Boxify)

This script brings back memories of when I first started learning to script... Well, bye.

  • Kratos232

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