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

TextLabel size doesn't change?

Asked by 4 years ago

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:

01local cel = script.Parent.Parent.Parent.Parent.sterownik.linia
02local tekst = script.Parent.Parent.Parent.Parent.przod_cel.SurfaceGui.ST1.TextLabel
03 
04while wait() do
05    if cel.Value == 5 then
06        tekst.Size = "{2, 0},{1, 0}"
07        if cel.Value == not 5 then
08            tekst.Size = "{1, 0},{1, 0}"
09 
10        end
11 
12    end
13end

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

1 answer

Log in to vote
1
Answered by 4 years ago

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

01local cel = script.Parent.Parent.Parent.Parent.sterownik.linia
02local tekst = script.Parent.Parent.Parent.Parent.przod_cel.SurfaceGui.ST1.TextLabel
03 
04cel:GetPropertyChangedSignal("Value"):Connect(function()
05    if cel.Value >= 5 then
06        tekst.Size = (UDim2.new(2, 0,1, 0))
07    elseif
08        cel.Value <= 5 then
09        tekst.Size = (UDim2.new(1, 0,1, 0))
10    end
11end)
Ad

Answer this question