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 3 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:

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

Log in to vote
1
Answered by 3 years ago

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)
Ad

Answer this question