generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Finding position?

Previous Thread :: Next Thread 
Dummiez is not online. Dummiez
Joined: 07 Feb 2009
Total Posts: 326
22 Feb 2014 03:44 PM
This is probably one of those really dumb questions and like ohh so that's how you get it. How do you get individual position of GUIs?

gui = script.Parent

x = gui.Position.X
y = gui.Position.Y

Or

gui = script.Parent

x = gui.Position.UDim2.X
y = gui.Position.UDim2.Y
Report Abuse
islandmaker2012 is online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
22 Feb 2014 03:49 PM
Gui = script.Parent
x = Gui.Position.X
y = Gui.Position.Y
print ("x ="x.." y ="..y")

--not sure
Report Abuse
SamuelKingx is not online. SamuelKingx
Joined: 27 Jan 2012
Total Posts: 3472
22 Feb 2014 03:51 PM
print(script.Parent.Position)
Report Abuse
Dummiez is not online. Dummiez
Joined: 07 Feb 2009
Total Posts: 326
22 Feb 2014 03:53 PM
The first one gives me a Userdata value error, and I need the positions stored in a variable, not printed.
Report Abuse
islandmaker2012 is online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
22 Feb 2014 03:55 PM
Idk I've done it before,but can't remeber how :/
Report Abuse
SamuelKingx is not online. SamuelKingx
Joined: 27 Jan 2012
Total Posts: 3472
22 Feb 2014 03:58 PM
is the Gui variable a screengui, a frame, a textbutton.. what is it?
Report Abuse
Dummiez is not online. Dummiez
Joined: 07 Feb 2009
Total Posts: 326
22 Feb 2014 04:00 PM
Okay, so I get this error in the following script, being specific as much as possible.

Cause it says in the first line: attempt to compare number with userdata.

if main.Position.X >= 355 and main.Position.X <= 480 then
if main.Parent.Position.Y >= 60 and main.Parent.Position.Y <= 185 then
p = script.Parent.Parent:GetChildren()
for i = 1, #p do
if (p[i].Name == "MoveGround") then
get = p[i]:Clone()
get.Motions.Disabled = true
get.Parent = script.Parent.Parent
p[i]:Destroy()
end
end
end
end
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
22 Feb 2014 04:00 PM
variablename = script.Parent.Position



OR to be more specific, make a bunch of variables...


a = Offset
b = Scale
c = script.Parent


lol = c.a
lolz = c.b
Report Abuse
Dummiez is not online. Dummiez
Joined: 07 Feb 2009
Total Posts: 326
22 Feb 2014 04:01 PM
Also, main is the gui. Forgot to add that in.
Report Abuse
Dummiez is not online. Dummiez
Joined: 07 Feb 2009
Total Posts: 326
22 Feb 2014 04:08 PM
Thanks guys, just figured it out :P


gui = script.Parent

x = gui.Position.UDim2.X.Offset
y = gui.Position.UDim2.Y.Offset
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
22 Feb 2014 04:09 PM
yeha, forgot to add that stuff in
Report Abuse
islandmaker2012 is online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
22 Feb 2014 04:21 PM
Righht,I forgot how to do that :)
I usually work with parts
And when I use UDim2.new,its usually for adding lol
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image