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

Cant Get Health Gui To Work With Filtering Enabled?

I have a health Gui That I am trying to convert to work with filtering Enabled. I know I'm doing something wrong but cannot seem to figure out what it is due to the fact that i not getting an error on the server or in studio.

I know this is y second question today but I am still learning and eager to finish the game im making so any help would be appreciated. Thank you

Server Script

local Event = game:GetService("ReplicatedStorage"): WaitForChild("HRE")


wait(0.5)


	
Event.OnServerEvent:connect(function(plr)
local char = plr
local hum = char.Character.Humanoid
plr.PlayerGui.Health.Frame.Health.Frame.Size = UDim2.new(hum.Health / hum.MaxHealth, 0, 1, 0)
	plr.PlayerGui.Health.Frame.Text.TextLabel.Text = math.floor(hum.Health) .. "/" .. hum.MaxHealth
	if hum.Health <= hum.MaxHealth * 0.15 then
		plr.PlayerGui.Health.Frame.Health.Frame.BackgroundColor3 = Color3.new(150 / 255, 0, 0)
	else
   		plr.PlayerGui.Health.Frame.Health.Frame.BackgroundColor3 = Color3.new(0, 220 / 255, 0)
	end
	
	end)

Local Script

local ReplicatedStorage = game:GetService('ReplicatedStorage')

wait(0.5)

local char = script.Parent.Parent.Parent.Character
local hum = char.Humanoid
	
hum.Changed:connect(function()

ReplicatedStorage.HRE:FireServer()
	

end)

2 comments

0

Why do you need remotes to accomplish this? You could accomplish this w/o remotes. >->

0

he couldn't, because with filtering enabled, you NEED to use remote for almost EVERYTHING. I suggest you take a look at this: http://wiki.roblox.com/index.php?title=Security

1 answer

I have this idea... I think the error is in the Server Script, and that in the LocalScript, everything is fine.

On the Server Script, try this:

local Event = game:GetService("ReplicatedStorage"): WaitForChild("HRE")

wait(.5)

Event.OnServerEvent:connect(function(player)
	repeat wait() until player:WaitForChild("PlayerGui")
	local hum = player.Character.Humanoid
	player.PlayerGui.Health.Frame.Health.Frame.Size = UDim2.new(hum.Health / hum.MaxHealth, 0, 1, 0)
	player.PlayerGui.Health.Frame.Text.TextLabel.Text = math.floor(hum.Health) .." / ".. hum.MaxHealth
	if hum.Health <= hum.MaxHealth * 0.15 then
		player.PlayerGui.Health.Frame.Health.Frame.BackgroundColor3 = Color3.new(150/255, 0/255, 0/255)
	else
	        player.PlayerGui.Health.Frame.Health.Frame.BackgroundColor3 = Color3.new(0/255, 220/255, 0/255)
	end
end)

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