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

why doesn't my mouse leave work?

Asked by 5 years ago

Please help, I don't get whats wrong and why it isn't working?

script.Parent.MouseEnter:Connect(function()
    script.Parent.Visible = false
    script.Parent.Parent.QuickMatchButton.Visible = true
end)
script.Parent.MouseLeave:Connect(function()
    script.Parent.Visible = true
    script.Parent.Parent.QuickMatchButton.Visible = false
end)
0
I have soooo many questions. Is this a LocalScript? What is the error? What does the output say? Is the Parent a GUI? Please give more backstory before posting, thanks. wentman 19 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

The problem is very simple. When your GUI's visibility is set to false, it basically acts like it's not there at all and hovering over won't do anything.

A simple fix to your problem is setting the transparency to 0 when leaving and back to 1 when entering (if this is a textbox, I recommend also setting the text transparency to 0/1 when entering/leaving as well). Something like this would work:

script.Parent.MouseEnter:Connect(function()
    script.Parent.BackgroundVisibility = 1
end)

script.Parent.MouseLeave:Connect(function()
    script.Parent.BackgroundVisibility = 0
end)

If you have any questions or issues, please contact me. ;)

0
Thanks :3 retrobricks 162 — 5y
0
No problem. lazycoolboy500 597 — 5y
Ad

Answer this question