Hello! I am trying to make a gui pop up when a player hovers their mouse over a button.
Here is my code:
local button = script.Parent
local clickDetector = button.ClickDetector
local screenGui = button.EnableStoring
local textLabel = screenGui.PopUp
screenGui.Enabled = false
clickDetector.MouseHoverEnter:Connect(function()
screenGui.Enabled = true
end)
clickDetector.MouseHoverLeave:Connect(function()
screenGui.Enabled = false
end)
Right now it does nothing and shows no errors.
NOTE: I am trying to refrain from using :GetMouse(), I want to use a clickdetector for a number of reasons.
golden_843
(Display_Name)
February 22, 2021, 4:14pm
#2
hello, every thing worked fine when I tried your code but I think I know why its not working for you. i used a billboard gui to pop up this works fine but if your using a screen gui then it needs to be in the players starter gui to show up if you need more assistance with this ill be glad to help!
I am also using a billboard gui.
golden_843
(Display_Name)
February 22, 2021, 4:18pm
#5
is it a local script? because that would be the problem
Erm, yes it is. I only want the client to see the gui though.
golden_843
(Display_Name)
February 22, 2021, 4:20pm
#7
ok great then you will need to put the billboard gui in the players starter gui for only one person to see it
Billboard guis show up in starter gui?
lluckvy
(aaron)
February 22, 2021, 4:21pm
#9
ClickDetectors don’t work on ScreenGui objects…
golden_843
(Display_Name)
February 22, 2021, 4:22pm
#11
yes i can write you a script for it you need to adornee it to the part you want in the billboard’s property’s
2 Likes
Oh my god, how did I not remember that.
lluckvy
(aaron)
February 22, 2021, 4:24pm
#13
I can’t download that, but the documentation doesn’t say so
golden_843
(Display_Name)
February 22, 2021, 4:24pm
#14
local scripts also don’t run normally you need to put the local script in the player
WarioSvug
(WarioSvug)
February 22, 2021, 4:24pm
#15
Yep, you can detect the player’s mouse, and each player has a hidden billboard GUI with their information on it, once you hover over the mouse, you can do mouse.Target.Parent.BillboardGui.Visible = true. Make sure it’s a local script so it doesn’t appear for everybody.
WarioSvug
(WarioSvug)
February 22, 2021, 4:25pm
#16
I’m sure there’s a “hover” too.
Ok so the adornee changes when you hover, but the text doesn’t appear.
golden_843
(Display_Name)
February 22, 2021, 4:29pm
#18
– I edited your script to work
– this works as a local script put it in starterplayer scripts and you dont need to move your gui to starter gui it works in the part
local button = game.Workspace.button – your button
local clickDetector = button.ClickDetector
local screenGui = button.EnableStoring
local textLabel = screenGui.PopUp
screenGui.Enabled = false
clickDetector.MouseHoverEnter:Connect(function()
screenGui.Enabled = true
end)
clickDetector.MouseHoverLeave:Connect(function()
screenGui.Enabled = false
end)
It has to be a billboardgui, it is ment to look like this:
golden_843
(Display_Name)
February 22, 2021, 4:35pm
#20
yes the script works as a billboard gui its a child of your part