How to make a gui show up when a player moves mouse on object using click detector

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.

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.

image

This is the layout.

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.

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?

ClickDetectors don’t work on ScreenGui objects…

robloxapp-20210222-1621574.wmv (341.3 KB)

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.

I can’t download that, but the documentation doesn’t say so

local scripts also don’t run normally you need to put the local script in the player

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.

I’m sure there’s a “hover” too.

Ok so the adornee changes when you hover, but the text doesn’t appear.

– 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:

image

yes the script works as a billboard gui its a child of your part