This SelectionBox isn't coming existent or something?
I'm trying to make a tool that, while it is equipped and the player holding the tool's mouse is over an unlocked part, a SelectionBox is created on the part.
It's a LocalScript directly in a tool (without RequiresHandle):
01 | repeat wait() until game.Players.LocalPlayer ~ = nil |
02 | local p = game.Players.LocalPlayer |
06 | local mouse = p:GetMouse() |
07 | local target = mouse.Target |
09 | script.Parent.Equipped:connect( function () |
13 | script.Parent.Unequipped:connect( function () |
17 | while holding = = true do |
19 | target.Changed:connect( function (newTarget) |
21 | if target.Locked ~ = true then |
22 | local box = Instance.new( "SelectionBox" , target) |
24 | box.LineThickness = 0.1 |
25 | box.Color 3 = Color 3. fromRGB( 255 , 128 , 0 ) |