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

How to make a Hover over Player GUI? [UNSOLVED]

Asked by 9 years ago

Hello. I am trying to make a hover over player GUI where basically when you hover over a player with your mouse the textlabel's text will turn into that players name and the textlabel will be visible. With this info I got this script,

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local label = player.PlayerGui.HoverGUI.TextLabel

mouse.Move:connect(function()
    local target = mouse.Target
    if target and target.Parent and game.Players:FindFirstChild(target.Parent.Name) then
        local otherPlayer = game.Players:FindFirstChild(target.Parent.Name)
        label.Text = otherPlayer.Name
        label.Position = UDim2.new(mouse.X, mouse.Y)
        label.Visible = true
    else
        label.Visible = false
    end
end)

the text label is in ----- game --> StarterGui --> HoverGui --> TextLabel HoverGui is the name of my screen GUI. This is also a local script in TextLabel

1 answer

Log in to vote
0
Answered by
hiccup111 231 Moderation Voter
9 years ago

You may want to look up how UDim2's...

UDim2 = X AXIS: (Scale,Offset) Y AXIS: (Scale,Offset)

Try (on line 10) setting the UDim2 position to just UDim2.new(0,0,0,0)

Ad

Answer this question