Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago
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

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 XAXA 1569 — 6y
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. Sergiomontani10 236 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

As XAXA previousley stated, there are two events called MouseEnterand 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)
0
Thanks a worked decently Sergiomontani10 236 — 6y
Ad

Answer this question