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

How do I make it where it changes the text when i hover my mouse over the GUI?

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local target = game.Workspace.PlayerEntered.CutsceneScript.SkipCutsceneGui.Skip
local label = workspace.PlayerEntered.CutsceneScript.SkipCutsceneGui.Skip

Mouse.Move:connect(function()
-- Checking if the target actually exists, and checks if the target is a descendant (child, direct or indirect) of our 'target'
    if Mouse.Target and Mouse.Target:IsDescendantOf(target) then
        label.Text = "Enter Life"
    else
        label.Text = "Lemme Play!"
    end
end)

Still cant figure out how to make it where when you hover over the GUI itll change what it says but if you stop having your mouse over it itll change back.

Heres the workspace

https://i.imgur.com/j0HmJji.png

2 comments

0

Gui objects have a MouseEnter event and a MouseLeave event. Try listening to these events. http://wiki.roblox.com/index.php?title=API:Class/GuiObject/MouseEnter http://wiki.roblox.com/index.php?title=API:Class/GuiObject/MouseLeave

0

I still don't get it. Im trying to make it when the mouse curser enters the GUI it changes the text. Im pretty new to script so I have no idea where to place it.

1 answer

✓ Accepted answer

As XAXA previousley stated, there are two events called MouseEnter and MouseLeave. These events fire when the mouse enters coordinates that are occupied by the gui object, and when the mouse leaves said coordinates

The way to get around your problem is to do the following:

local label = workspace.PlayerEntered.CutsceneScript.SkipCutsceneGui.Skip
label.Text = 'Lemme Play!' --Set it the first time so it's not blank

label.MouseEnter:connect(function() --Mouse entered!
	label.Text = 'Enter Life' 
end)

label.MouseLeave:connect(function() --Mouse left!
	label.Text = 'Lemme Play!'
end)

1 comment

0

Thanks a worked decently

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