So, here’s what I want:
I have a GUI, and there’s a regular button in it. When I hover over the button, a TextLabel will appear (It will describe the function and the purpose of that button), and that TextLabel is supposed to follow your mouse cursor. When you leave the button’s area, the TextLabel disappears, simple as that.
I tried doing this, but for some reason, the TextLabel won’t appear at all, and there are no errors in the Developer Console. Can someone help me understand what’s wrong?
(It’s a LocalScript, if it wasn’t obvious)
This is what I have:
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local button = script.Parent
local label = script.Parent.TextLabel
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
button.MouseEnter:Connect(function()
label.Visible = true
end)
button.MouseLeave:Connect(function()
label.Visible = false
end)
function follow()
if label.Visible == true then
label.Position = UDim2.new(0, mouse.X, 0, mouse.Y)
else
return
end
end
mouse.Move:Connect(follow)
I will appreciate all kinds of help. Thanks.