Hello everyone,
i have a problem with my screen bar if the player life is getting higher(power value = maxhealth+powervalue) then my health bar is sizing to much (Screen Shot) maybe someone see the error or soluation ?
local Players = game:GetService("Players")
local player = Players.LocalPlayer or Players:GetPropertyChangedSignal("LocalPlayer"):wait()
local character = player.Character or player.CharacterAdded:wait()
local PlayerLevel = player:WaitForChild("leaderstats").Level.Value
local human = character:FindFirstChild("Humanoid")
local health = human.Health
local maxhealth = human.MaxHealth
local PlayerXP = player:WaitForChild("playerdata"):WaitForChild("XP")
local xpToLevelUp = function(level)
return 100 + level * 5
end
while wait() do
local pourcentage = math.floor(player:WaitForChild("playerdata"):WaitForChild("XP").Value/xpToLevelUp(player:WaitForChild("leaderstats"):WaitForChild("Level").Value) * 100)
if health then
script.Parent:TweenSize(UDim2.new(player:WaitForChild("playerdata"):WaitForChild("XP").Value/xpToLevelUp(player:WaitForChild("leaderstats"):WaitForChild("Level").Value), 0, 1, 0))
script.Parent.Parent.TextLabel.Text = pourcentage.. "%"
end
end
i already tryed something like that
if health == maxhealth or health > maxhealth then
script.Parent.Size = UDim2.new(1, 0,1, 0)
end

3 comments
ok i can tell you the issue right now, dont use offset in the sizing, only use scale or it will go outside the frame
hes right
He's not using Offset he's using Scale