wait(1)
while wait() do
if Character.Humanoid.Health == 100 then
script.Parent.Parent.Parent.Visible = false
end
if Character.Humanoid.Health <= 99 then
script.Parent.Parent.Parent.Visible = true
end
script.Parent.Size = UDim2.new(Character.Humanoid.Health / Character.Humanoid.MaxHealth, 0, 1, 0)
end
How would I use this for serverside instead of only the client seeing their bar change?
Character.Humanoid:GetPropertyChangedSignal("Health"):Connect(function(property)
-- code here (Example, print(property) -- prints the health after it was changed)
end)
Are you trying to make a healthbar? If so, it is possible to handle health bars entirely on the client, rather than rendering them on the server, using character added and health changed events.
local PrevHealth = 100
Character.Humanoid:GetPropertyChangedSignal("Health"):Connect(function(property)
if PrevHealth < property then return end PrevHealth = property
end)