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

Help with MouseHoverLeave?

Asked by
FiredDusk 1466 Moderation Voter
8 years ago

I got when you hover over a part, a gui pops up but when the players mouse leaves, I want the gui to have visible = false

function Leave (Player)

end

Part = script.Parent
function Enter (Player)
    for i,v in pairs {Player} do

        v.PlayerGui.Hovered.Label.Visible = true
        script.Parent.String.Value = "Cup"
    end
end

Part.ClickDetector.MouseHoverEnter:connect(Enter)

1 answer

Log in to vote
1
Answered by 8 years ago
script.Parent.ClickDetector.MouseHoverEnter:connect(function(plr)
    for i,v in pairs {plr} do

        v.PlayerGui.Hovered.Label.Visible = true
        script.Parent.String.Value = "Cup"
    end
end)

script.Parent.ClickDetector.MouseHoverLeave:connect(function(plr)
 plr.PlayerGui.Hovered.Label.Visible = true
--script.Parent.String.Value = "derp"
end)

So first off i redid the organization of the script, it will work the same exact way. Secondly you had everything right. But for the problem you have, you must use the ****MouseHoverLeave**** event. This event fires whenever the mouse cursor leaves the click detector.

----Hope i helped you

Ad

Answer this question