Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

when hover over imagebutton then textlabel will show up & when not hovering it will leave?

What I need done : When you hover over an imagebutton then a textlabel will pop and when you are done hovering over the imagebutton it will disappear.

Local Script inside ImageButton :


SP = script.Parent

SP.MouseEnter:connect(function()
game.StarterGui.PerkMessage.MsgOne.Visible = true

end)

SP.MouseLeave:connect(function()
game.StarterGui.PerkMessage.MsgOne.Visible = false
end)

1 answer

Your issue is that you're using game.StarterGui instead of finding the player's playerGui. Changing the StarterGui will only change the game's GUI, instead of the player's GUI. To begin, your code should already be in a local script since they control the player's GUIs.

Then, we can make a variable for the player using local player = game.Players.LocalPlayer

Now, we can find the player's PlayerGui by doing local PlayerGui = player.PlayerGui then just replacing game.StarterGui with PlayerGui

SP = script.Parent
local player = game.Players.LocalPlayer
local PlayerGui = player.PlayerGui

SP.MouseEnter:connect(function()
PlayerGui.PerkMessage.MsgOne.Visible = true

end)

SP.MouseLeave:connect(function()
PlayerGui.PerkMessage.MsgOne.Visible = false
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.