Try making a billboard GUI in the part and use this:
local Input = game:GetService("UserInputService")
local LocalPlayer = game.Players.LocalPlayer
local Mouse = player:GetMouse()
Input.InputChanged:Connect(function(i)
if Mouse.Target then
if Mouse.Target:FindFirstChild("billboardguiname") then
-- do stuff
else
-- remove the else or do stuff here
end
end
end)
Make a new tool and put a localscript in the tool. In the parts that you want a selectionbox whenever you hover over it, put anything (i put a texture) in that part named Part4.
local equipped = false
local Tool = script.Parent
local UserInputService = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local selectionBox = false
UserInputService.InputChanged:Connect(function(input,isTyping)
if not isTyping then
local mouseTarget = mouse.Target
if mouseTarget and plr.Character:FindFirstChild(script.Parent.Name) then
if mouseTarget.Name == "Part" then
local partdescendant = mouse.Target:FindFirstChild('Part4')
if partdescendant and selectionBox ~= true then
selectionBox = true
local selectionBox = Instance.new("SelectionBox")
selectionBox.Parent = partdescendant.Parent
selectionBox.Adornee = partdescendant.Parent
end
end
else
for i,v in pairs(game:GetDescendants()) do
if v:FindFirstChild("Part4") and v:FindFirstChild("SelectionBox") and v.Name == "Part" then
v.SelectionBox:Destroy()
end
selectionBox = false
end
end
end
end)
Do you want it so if you hover over any part, it’ll show a selection box? this only does it for specific parts.