Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

why is this health gui glitching out when player zooms out?

Asked by
MHaven1 159
7 years ago
Edited 7 years ago
local player = script.Parent.Parent.Parent.Parent.Parent
player.Humanoid.Changed:connect(function()
    local redhealth = player.Humanoid.MaxHealth / 4
    if player.Humanoid.Health <= redhealth then
        script.Parent.BackgroundColor3 = Color3.new(255,0,0)
    end
    if player.Humanoid.Health > redhealth then
        local brickcolor = BrickColor.new("Lime green")
        local color = brickcolor.Color
        script.Parent.BackgroundColor3 = color
    end
    script.Parent.Size= UDim2.new(0,(player:WaitForChild("Humanoid").Health / player:WaitForChild("Humanoid").MaxHealth * 200),1,0)
end)

when players health is low the gui glitches the red bar goes bigger then the backgorund. please help. when you zoom out the red bar is not the same size as the background gui so like when i zoom it the red bar's size increases and when i zoom in it decreases. if you do not understand what i am trying to say post a comment then i will show you what i mean.

0
your bar is probably not 200 pix long. check the size of the bar. RubenKan 3615 — 7y
0
{1, 0},{1, 0} my bar size MHaven1 159 — 7y

1 answer

Log in to vote
1
Answered by
Xiousa 156
7 years ago

Instead of doing UDim2.new(0,(player:WaitForChild("Humanoid").Health / player:WaitForChild("Humanoid").MaxHealth * 200),1,0)do UDim2.new(player:WaitForChild("Humanoid").Health / player:WaitForChild("Humanoid").MaxHealth, 0, 1, 0)

Ad

Answer this question