Ive been trying to make a health gui for an object, ive made it so its ontop of said object. But i want it to be a gui on the screen.
Does anyone have any ideas?
Please try it first. We are not a place to ask for scripts!
Short answer:
First you'll have to get the players Humanoid.Health
.
-- Local Script Example 1 --
local player = game.Players.LocalPlayer local char = player.Character local humanoid = char.Humanoid local hp = humanoid.Health
From there if you are good, you should be able to do it. hint: health / maxHealth
Long answer:
local player = game.Players.LocalPlayer local char = player.Character local humanoid = char.Humanoid local hp = humanoid.Health local maxHealth = humanoid.MaxHealth local bar -- The path to the bar, we'll never make the gui, make it yourself! humanoid.HealthChanged:Connect(function(health) bar.Size = UDim2.new(health / maxHealth, 0, bar.Size.Y.Scale, bar.Size.Y.Offset) end)