Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Highlight door when mouse is hovering it?

Ok so I made a door that has a selection box that is not visible so I made a local script that makes when your hover the mouse on the door the selection box shows and when you stop hovering the mouse it hides again but it only works with normal scripts and I want to make it so only the player that is hovering the mouse can see it

Here is the script:

script.Parent.ClickDetector.MouseHoverEnter:Connect(function()
	script.Parent.SelectionBox.Visible = true
end)

script.Parent.ClickDetector.MouseHoverLeave:Connect(function()
	script.Parent.SelectionBox.Visible = false
end)

1 answer

✓ Accepted answer

Use mouse.target

you have to get the mouse first from the player:

(in a localscript)

players = game:GetService ("Players")
localPlayer = players.LocalPlayer
mouse = localPlayer:GetMouse()
door = -- door instance like idk workspace.door

while true do
   if mouse.Target == door then
       door.SelectionBox.Visible = true
   else
        door.SelectionBox.Visible = false
   end

Plz tell me if there is any errors or misspellings im writing this on mobile

4 comments

0

It didnt work but thanks for the help <3

0

hmm... did it throw any errors? you might also beed to adapt the code to your needs, not just copy and paste.

0

ill be hapoy to help you further!

0

It didnt throw errors but it doesnt matter anymore

This discussion is preserved as it was. New answers, comments, and votes are closed.