Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I have a script but it doesnt work, how can I get it to work with Filtering Enabled?

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)

1 comment

0

So your issue is solved?

1 answer

✓ Accepted answer

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

1 comment

0

The issue wasnt that it wont display health or anything, the issue was it wouldnt display the GUI at all, however I fixed that.

This discussion is preserved as it was. New answers, comments, and votes are closed.