I have tried to make a GUI that, when your mouse cursor hovers over another player, it shows their name, and when you hover off, it disappears. I've tried a couple things, but I can't seem to make it work. Here's my current code, and feel free to do whatever you need to do- even a small hint will help. :happy:
1 | local players = game:GetService( "Players" ) |
2 |
3 | local gui = script.Parent |
4 | local player = players.LocalPlayer |
5 | local mouse = player:GetMouse() |
6 |
7 | mouse.Move:connect( function () do |
8 |
9 | end ) |
You'll need to check mouse.Target which hosts the object the mouse is pointing to. Also, I suggest you create a textlabel of some sort. However, this will put you on the right track.
Code:
01 | local players = game:GetService( "Players" ) |
02 |
03 | local gui = script.Parent |
04 | local player = players.LocalPlayer |
05 | local mouse = player:GetMouse() |
06 |
07 | mouse.Move:connect( function () do |
08 | local target = mouse.Target |
09 | if target and target.Parent:FindFirstChild( "Humanoid" ) then |
10 | local plr = game.Players:GetPlayerFromCharacter(target.Parent) |
11 | if plr and plr ~ = player then |
12 | print (plr.Name) |
13 | end |
14 | end |
15 | end ) |