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

Object highlight on cursor hover script not working, any help?

Asked by 2 years ago
Edited 2 years ago

In one of my games I have a drawer cabinet where when you hover your cursor over each drawer, a highlight appears. However, something isn't working and I don't know how to fix it. The script that I used on one of the drawers is shown below.

local thang = script.Parent.Parent:WaitForChild("Drawer2")
local clickdetector = thang.ClickDetector

function OnHover()
    thang.Selection.OutlineTransparency =  .3
end

function OffHover()
    thang.Selection.OutlineTransparency =  1
end

script.Parent.ClickDetector.MouseHoverEnter:connect(OnHover)
script.Parent.ClickDetector.MouseHoverLeave:connect(OffHover)

When I hover my cursor over drawer2, the highlight for it appears. However, the highlight for another one of the drawers also appear, without me having to even hover my mouse over it. I didn't script that in. There are NO errors in the output and I can't figure out what to do. Could someone help me? A video of the problem is here at this link: [https://www.youtube.com/watch?v=oEAk44jBS6o]

Answer this question