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

Add a selectionbox

Asked by 10 years ago

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

Log in to vote
7
Answered by
ImageLabel 1541 Moderation Voter
10 years ago

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.

0
Thanks. StoleObamasKfc 10 — 10y
Ad
Log in to vote
0
Answered by
Kratos232 105
10 years ago

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

Answer this question