Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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.

2 comments

0

your bar is probably not 200 pix long. check the size of the bar.

0

{1, 0},{1, 0} my bar size

1 answer

✓ Accepted answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.