Ok. So I am basically branching of of FastSnail5's question. But mine is different. How do you make the textlabel's text the players name when you hover over a player? Here is my script from RavenShield. I just don't know what to make the target or if I just have to change the whole entire script. (This is a local script)
local player = game.Players.LocalPlayer local mouse = player:GetMouse() local target = game.Players -- Don't know what the target should be... local label = player.PlayerGui.HoverGUI.Frame.TextLabel mouse.Move:connect(function() if mouse.Target and mouse.Target:IsDescendantOf(target) then label.Text = target.Name label.Visible = true else label.Visible = false label.Text = "" end end)
Try this:
local player = game.Players.LocalPlayer local mouse = player:GetMouse() local label = player.PlayerGui.HoverGUI.Frame.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)
That should work.
PLEASE UPVOTE IF THIS ANSWER IS GOOD!
You could've just messaged me, but I'll give a helping hand anyway.
What you want to do is take use of Mouse.Target, and see if Mouse.Target is child of either players' character. Assuming a player's character is built up by parts inside a model, you can take use of game.Players:GetPlayerFromCharacter(model) to verify if the target actually is a player. http://wiki.roblox.com/index.php?title=API:Class/Players/GetPlayerFromCharacter
local player = game.Players.LocalPlayer local mouse = player:GetMouse() local label = player.PlayerGui.HoverGUI.Frame.TextLabel mouse.Move:connect(function() if mouse.Target and game.Players:GetPlayerFromCharacter(mouse.Target.Parent) then label.Text = mouse.Target.Parent.Name label.Visible = true else label.Visible = false label.Text = "" end end)
bruh idk why u put so many lines, make a textlabel in your screengui and make a local script into the textlabel and just put this:
local player = game.Players.LocalPlayer.Name
script.Parent.Parent.TextLabel.Text = player
oh and bro, i just tried to help you make a little script if u want something advanced sorry but that's how it worked for me