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

GUI moving all over the screen?

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
--It goes
While true do
game.startGUI.box1.position=(5, 5, 5)
wait(.01)
game.startGUI.box1.position=(6, 6, 6)
end

Is this right or did it say something wrong?

0
Yes the 5 and 6 location is not correct but it is for examples. ChefBuckeye 0 — 10y

1 answer

Log in to vote
0
Answered by
duckwit 1404 Moderation Voter
10 years ago

There are a multitude of syntactical and functional mistakes in what you have written, namely:

  1. While should be lower case, as in "while"
  2. position should be upper case, as in "Position"
  3. The Position property of a GUI Object takes a UDim2 object as input, and a Part takes a Vector3 - I can't tell which you need to use from this code because I don't know what box1 is.
  4. startGUI is not a valid member of game, it doesn't exist, the actual name is StarterGui
  5. The wait() function will only yield the thread (stop that script from running) for a minimum of 1/30th of a second, approximately 0.033, which is bigger than .01, so it will actually wait for 1/30th of a second instead of 1/100th.

A side note is that this script doesn't make any sense whatsoever: If box1 is a GUI Object then why would you be using 3 coordinates to describe it's position (user interfaces in Roblox are 2 dimensional), and if it is actually a 3D Part, why is it being stored in the game's StarterGui, which is for GUI objects.

FURTHERMORE, changing the position of a GUI Object in the StarterGui affects the template that is used to copy the GUI to each player, and not the Player's GUIs themselves, so even with a working script to change the position of box1 nobody would see it moving.

Ad

Answer this question