Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Highlight door when mouse is hovering it?

Asked by 4 years ago
Edited 4 years ago

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

Log in to vote
0
Answered by
Erie20 102
4 years ago

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

0
It didnt work but thanks for the help <3 0Papa_Rat0 63 — 4y
0
hmm... did it throw any errors? you might also beed to adapt the code to your needs, not just copy and paste. Erie20 102 — 4y
0
ill be hapoy to help you further! Erie20 102 — 4y
0
It didnt throw errors but it doesnt matter anymore 0Papa_Rat0 63 — 4y
Ad

Answer this question