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

TextLabel size doesn't change?

So i want to change the TextLabel size when a specific value is on, but it doesn't change at all.

Here's my code:

local cel = script.Parent.Parent.Parent.Parent.sterownik.linia
local tekst = script.Parent.Parent.Parent.Parent.przod_cel.SurfaceGui.ST1.TextLabel

while wait() do
	if cel.Value == 5 then
		tekst.Size = "{2, 0},{1, 0}"
		if cel.Value == not 5 then
			tekst.Size = "{1, 0},{1, 0}"
			
		end
		
	end
end

What am i doing wrong? It doesn't display any errors.

1 answer

✓ Accepted answer

Something like this should work, but I don't have the time to test. (I suggest adjusting the sizes a bit tho.)

local cel = script.Parent.Parent.Parent.Parent.sterownik.linia
local tekst = script.Parent.Parent.Parent.Parent.przod_cel.SurfaceGui.ST1.TextLabel

cel:GetPropertyChangedSignal("Value"):Connect(function()
	if cel.Value >= 5 then
		tekst.Size = (UDim2.new(2, 0,1, 0))
	elseif
		cel.Value <= 5 then
		tekst.Size = (UDim2.new(1, 0,1, 0))
	end
end)

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