I made a door model with a clickdetector. I Gui I made Gui labels and then put in this localscript
local player = game.Players.LocalPlayer local gui = player:WaitForChild("PlayerGui") local screenGui = gui:WaitForChild("KeyE") local imageLabel = screenGui:WaitForChild("EButton") local clickdetector = game.workspace.Door:WaitForChild("ClickDetector") screenGui.Enabled = false clickdetector.MouseHoverEnter:connect(function() screenGui.Enabled = true end)
When I hover over the the model, it makes the gui visible.. when it is not hovering, it does not go away... how do I do this thank you.
--I wish to make the gui pop up when my mouse is hovering over the model and disappear when it is not. Thank you
You’ll have to use an event called “MouseHoverLeave” if you want the GUI to be disabled when the player hovers away.
Here’s your fixed script. I added the function in so it should work :
local player = game.Players.LocalPlayer local gui = player:WaitForChild("PlayerGui") local screenGui = gui:WaitForChild("KeyE") local imageLabel = screenGui:WaitForChild("EButton") local clickdetector = game.Workspace.Door:WaitForChild("ClickDetector") screenGui.Enabled = false clickdetector.MouseHoverEnter:Connect(function() screenGui.Enabled = true end) clickdetector.MouseHoverLeave:Connect(function() screenGui.Enabled = false end)