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:
01 | local cel = script.Parent.Parent.Parent.Parent.sterownik.linia |
02 | local tekst = script.Parent.Parent.Parent.Parent.przod_cel.SurfaceGui.ST 1. TextLabel |
03 |
04 | while 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 |
13 | end |
What am i doing wrong? It doesn't display any errors.
Something like this should work, but I don't have the time to test. (I suggest adjusting the sizes a bit tho.)
01 | local cel = script.Parent.Parent.Parent.Parent.sterownik.linia |
02 | local tekst = script.Parent.Parent.Parent.Parent.przod_cel.SurfaceGui.ST 1. TextLabel |
03 |
04 | cel:GetPropertyChangedSignal( "Value" ):Connect( function () |
05 | if cel.Value > = 5 then |
06 | tekst.Size = (UDim 2. new( 2 , 0 , 1 , 0 )) |
07 | elseif |
08 | cel.Value < = 5 then |
09 | tekst.Size = (UDim 2. new( 1 , 0 , 1 , 0 )) |
10 | end |
11 | end ) |