How can I make SurfaceGui based HealthGui?


Hello, I scripted a SurfaceGui for client camera and I want to know how to turn this part of the SurfaceGui into HealthGui?:
Screenshot_2762
Thanks.

2 Likes

Place a frame inside the orange bar, and have it ratio based
Position = {0, 0} {0, 0}
Size = {1, 0} {1, 0}
Then have the size change based off of the players health.

player.Character.Humanoid:GetPropertyChangedSignal("Health"):Connect(function()
    local Rate = player.Character.Humanoid.Health/player.Character.Humanoid.MaxHealth
    Frame.Size = UDim2.new(Rate, 0, 1, 0)
    Frame.Position = UDim2.new(1 - Rate, 0, 0, 0)
end)

I hope this is what you were looking for.

1 Like