1 Like
Try using Mouse.Target
:
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local part = Mouse.Target -- The BasePart the Mouse is currently hovering on
how do i get it to remove it when the mouse moves away from one thing and onto another, that’s the issue i’ve been having
Try saving the part as a variable, and if Mouse.Target
isn’t that variable, remove the highlight and set the variable to nil.
local PartSelected = nil
RunService.RenderStepped:Connect(function()
if not PartSelected then
PartSelected = Mouse.Target
local Highlight = script.BlockHighlight:Clone()
Highlight.Parent = PartSelected
elseif PartSelected and Mouse.Target ~= PartSelected then
PartSelected.BlockHighlight:Destroy()
PartSelected = nil
end
end)
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.