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

Help me with my GUI problem?

The script below changes the size of BlockBar based on the Values of BlockValue and MaxBlockValue. When the value of BlockValue decreases so should the size of the bar.

The script does decrease the size however it decreases sideways, it should be decreasing downwards.

This what the problem looks like : PROBLEM

local Player = game.Players.LocalPlayer

Player.CharacterAdded:connect(function()

	local BlockBar = script.Parent
	local BlockValue = Player.Character:WaitForChild("BlockValue")
	local MaxBlockValue = Player.Character:WaitForChild("MaxBlockValue")

	while wait() do

		BlockBar.Size = UDim2.new((BlockValue.Value / MaxBlockValue.Value) * 0, 0, 0.8, 0)

	end
end)

pls help.

1 answer

✓ Accepted answer

You're changing the X

BlockBar.Size = UDim2.new( 0, 50, (BlockValue.Value / MaxBlockValue.Value)*0.8, 0)

UDim2 is in the order (ScaleX, OffsetX, ScaleY, OffsetY), and you had made the mistake of changing the X scale instead of changing the Y scale.

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