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

How may I fix this start of an intro gui?

Asked by 8 years ago

I am trying for the first time (for me) to make an intro gui w/ a moving button but i'm being stupid and not making it work. Please look at my code and tell me how to make it not run into some weird loop or whatever it is doing to shut down my roblox studio.

Gui = {script.Parent.Frame, script.Parent.ButtonBack, script.Parent.TextButton, script.Parent.TextLabel, script.Parent}
Frame = Gui[1]
ButtonBack = Gui[2]
TextButton = Gui[3]
TextLabel = Gui[4]
Parent = Gui[5]

TextButton.MouseButton1Down:connect(function()
    if TextButton.Position == UDim2.new(0, 860, 0, 445) then
        print(TextButton.Position)
        while TextButton.Position ~= ButtonBack.Position do
            TextButton.Position = TextButton.Position+UDim2.new(0, 0, 0, 0.1)
        end
    end
end)

at line 9 i'm referring to what the position is/should be at the start.

1 answer

Log in to vote
0
Answered by
Pyrondon 2089 Game Jam Winner Moderation Voter Community Moderator
8 years ago

I think your problem would be line 9. If you tried print(TextButton.Position) The UDim2 wouldn't be there, just four numbers with {} brackets. So maybe:

Gui = {script.Parent.Frame, script.Parent.ButtonBack, script.Parent.TextButton, script.Parent.TextLabel, script.Parent}
Frame = Gui[1]
ButtonBack = Gui[2]
TextButton = Gui[3]
TextLabel = Gui[4]
Parent = Gui[5]

TextButton.MouseButton1Down:connect(function()
    if tostring(TextButton.Position) == "{0, 860}, {0, 445}" then
        print(TextButton.Position)
        while TextButton.Position ~= ButtonBack.Position do
            TextButton.Position = TextButton.Position+UDim2.new(0, 0, 0, 0.1)
        end
    end
end)

would work? Either way, I wouldn't recommend doing it like this. Roblox has built in methods for tweening, you should check those out.

0
I see what you where saying but it still doesn't work. MrDefaultMan 113 — 8y
Ad

Answer this question