well ive got the stats down and i make the health go up 10% per stat point but my health bars arent updating the health.
Heres the script for the health bar:
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local healthFrame = script.Parent
local healthBar = healthFrame:WaitForChild("HealthBar")
local healthText = healthFrame:WaitForChild("HealthText")
local function updateHealthBar()
local current = humanoid.Health
local max = humanoid.MaxHealth
local percent = math.clamp(current / max, 0, 1)
local function formathealth(amount)
amount = math.round(amount)
if amount >= 1e12 then
return string.format("%.2f T", amount / 1e12)
elseif amount >= 1e9 then
return string.format("%.2f B", amount / 1e9)
elseif amount >= 1e6 then
return string.format("%.2f M", amount / 1e6)
elseif amount >= 1e3 then
return string.format("%.1f K", amount / 1e3)
else
return tostring(amount)
end
end
local targetSize = UDim2.new(percent, 0, 1, 0)
local sizeTween = TweenService:Create(healthBar, TweenInfo.new(0.3, Enum.EasingStyle.Quad), {Size = targetSize})
sizeTween:Play()
healthText.Text = "HP: " .. formathealth(current) .. " / " .. formathealth(max)
end
humanoid:GetPropertyChangedSignal("MaxHealth"):Connect(updateHealthBar)
humanoid:GetPropertyChangedSignal("Health"):Connect(updateHealthBar)
updateHealthBar()
** You are now Level 3! **