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)
workspace.Part.Touched:connect(function(hit) c = Instance.new("SelectionBox", hit) c.Adornee = hit end)
Also, You've got to set the Adornee.
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.