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

Why can't I check my gui's position by script?

Asked by 9 years ago
if script.Parent.Position == {0,0},{0.1,0} then...

However, I get an error.

Players.Player.PlayerGui.Menu.Background.MickeyMouse.MickeyMouse.Script:3: 'then' expected near ','

I did not give you the full script, the code above is line 3 which is where the error originates from and I am suspecting that it has to do with the way it's written which is probably where the error is made. Please help me, thanks.

Also one more thing, is there a way to have everything running in one script? For instance, everything running at the same time in one script or does it need to be in separate scripts for everything to run at the same time?

2 answers

Log in to vote
1
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
9 years ago

script.Parent.Position is a UDim2 value.

{0, 0}, {0.1, 0} are two table values.

Two tables values are not a UDim2.


To make a UDim2, use UDim2.new(0, 0, 0.1, 0); you would compare to that instead.

However, you probably shouldn't check the GUI's position. Instead, look at the state that controls where the GUI is (is it Visible, is there some "mode" that you can keep track of?)

Ad
Log in to vote
-1
Answered by 9 years ago

UDim2 is how GUIs display their positions. You would check it like this:


if script.Parent.Position == UDim2.new{0,0,0.1,0} then --code end

For the multiple codes in one script, use threads. For that, you'll have to review coroutines on the roblox wiki.

Answer this question