Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local players = game:GetService("Players");
- local runService = game:GetService("RunService");
- local localPlayer = players.LocalPlayer;
- local screenGui = script.Parent;
- local healthBar = screenGui.Health;
- local bar = healthBar.Bar;
- local amount = healthBar.Amount;
- runService.RenderStepped:Connect(function()
- local character = localPlayer.Character;
- local humanoid = character and character.Humanoid;
- if character and humanoid then
- local health = humanoid.Health;
- local maxHealth = humanoid.MaxHealth;
- local xScale = (health / maxHealth);
- bar:TweenSize(UDim2.new(xScale, 0, 1, 0), "Out", "Sine", 0.1, true);
- amount.Text = math.floor(health + 0.5);
- end
- end);
RAW Paste Data