CORRECTION: The script does work, but how can I get it to display the GUI right next to the mouse, and display their rank in a group as well?
local Player=game.Players.LocalPlayer local gui = script.Parent.Frame repeat wait() until Player and Player.Character and wait(5) local Character=Player.Character local mouse=Player:GetMouse() local hoverPlayer = false mouse.Move:connect(function() if mouse.Target ~= nil then local humanoid, player = mouse.Target.Parent:findFirstChild("Humanoid"), game.Players:FindFirstChild(mouse.Target.Parent.Name) if humanoid and player then if not hoverPlayer then gui.NameLabel.TextColor3 = player.TeamColor.Color gui.NameLabel.Text = humanoid.Parent.Name gui.HealthLabel.Text = math.ceil(mouse.Target.Parent.Humanoid.Health / mouse.Target.Parent.Humanoid.MaxHealth * 100) .."%" hoverPlayer = true end else hoverPlayer = false gui.NameLabel.Text = "" gui.HealthLabel.Text = "" end end end)
Basically, when you turn Filtering Enabled
on you are disconnecting the Client
and Server
side of your game. Your script here is on the Client side since you are using the Mouse object from the player. And now you want to hover over another player and get their name and health. To get the health of a player you are going to need their Humanoid
, and where is that? That is on the server side. So in order to access it, you will need to Invoke the server using a Remote Function
which will connect you to the server and return the value you need.
Here are two resources for you, devforum.roblox.com/t/what-is-filteringenabled/67927 wiki.roblox.com/index.php?title=Remote_Functions_%26_Events