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

How can i make my gui stop at a certain size?.

Asked by
Damo999 182
10 years ago

Here is the code, again i am trying to make my gui stop after it has hit a specific size i use a while loop in my script and i try to break that loop once my gui has reached it's desired size but it keeps going past my intended size.

button = game.Workspace.button
isDown = false

button.ClickDetector.MouseClick:connect(function()
    if not isDown then
        isDown = true
        while isDown do
            wait(2)
            script.Parent.Size = UDim2.new(script.Parent.Size.X.Scale-.1, script.Parent.Size.X.Offset,                                          script.Parent.Size.Y.Scale-1, script.Parent.Size.Y.Offset)
            if script.Parent.Size == UDim2.new({-0.7, 150},{0, 30}) then -- having trouble around here
                 break
                end
            end
    else 
        isDown = false
        print("Door Down")
    end
end)
0
It wouldn't indent properly. Damo999 182 — 10y
0
There is no need for the '{}''s on line 10. TheeDeathCaster 2368 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago
UDim2.new({-0.7, 150},{0, 30})

This is one mistake i found. I've never needed to change the Size like that so i'm not sure if that's the whole problem, but try this instead:

UDim2.new(-0.7, 150, 0, 30)
Ad

Answer this question