I’m not too sure exactly what you are trying to accomplish, but here is a good start to it :
local mouse = game.Players.LocalPlayer:GetMouse() -- Getting the local player's mouse
mouse.Move:Connect(function(movement) -- When the players mouse moves on the screen
local target = mouse.Target -- The target of the mouse (what the players mouse is hovering over)
local selection = Instance.new("SelectionBox", target) -- A new instance of a selection box
selection.Adornee = target -- Setting the adornee (basically the parent of the selection box) to the mouse's target
selection.Color3 = Color3.new(0, 1, 0.974182) -- **Put whatever Color3 value you want here**
mouse.Move:Connect(function(movement2) -- Making another move function to check if the mouses target has been changed
local target2 = mouse.Target
if target2 ~= target then -- Checking exactly if the new target of the mouse is the same as last ones
selection:Destroy() -- Destroying the selection box if it isn't the same as the last target
end
end)
end)
Make sure to put this code in a Local Script, inside of StarterCharacterScripts. If you want me to expand on this code (only making the selections when in certain areas or only while doing certain things) let me know and I can help out more.