Is there a way to put a selection box only around one part when the players mouse is in front of it... The wiki shows how to put a selection box around every part but I want it to do it for only one part So if it was over a players torso It would add a selection box around it.. I dont want to request I just want an Idea of how to do it! :D Thanks!
local player = game.Players.LocalPlayer local mouse = player:GetMouse() local targets = {Torso = true, HumanoidRootPart = true} local sel = Instance.new("SelectionBox", player.PlayerGui) mouse.Move:connect(function() if mouse.Target and targets[mouse.Target.Name] then sel.Adornee = mouse.Target else sel.Adornee = nil end end)
Hello Timster111!
Yes, there is a way to put a selection box over just a part. Just set the Selection Box's Adornee property to the part in question. Your question about putting it over a part hovered over by the mouse is a tad bit trickier, but very doable.
--note that this needs to be in a local script --define variables local m = game.Players.LocalPlayer:GetMouse() local IsBoxUp = false local BoxedPart = nil --set an anonymous function to run every time the player moves his mouse --you can use a while loop if you want it to check constantly, but I find this to be less of a strain m.Move:connect(function() if m.Target then if not IsBoxUp then --make the box IsBoxUp = true BoxedPart = m.Target sb = Instance.new("SelectionBox", m.Target) sb.Adornee = m.Target elseif IsBoxUp and m.Target ~= BoxedPart then --destroy the old box and make a new one sb:Destroy() BoxedPart = m.Target sb = Instance.new("SelectionBox", m.Target) sb.Adornee = m.Target end end end)