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: How do I convert Vector3 to UDim?

Previous Thread :: Next Thread 
trappingnoobs is not online. trappingnoobs
Joined: 05 Oct 2008
Total Posts: 19100
09 Jan 2010 10:07 AM
title. I think I spelt UDim2 wrong, but nevermind.
Report Abuse
bobob55 is not online. bobob55
Joined: 24 Jul 2008
Total Posts: 4522
09 Jan 2010 10:10 AM
UDmin2?...
Report Abuse
trappingnoobs is not online. trappingnoobs
Joined: 05 Oct 2008
Total Posts: 19100
09 Jan 2010 10:12 AM
.. You dont even know what it is?
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
09 Jan 2010 10:12 AM
UDim and UDim2 are both tables...

Vector3? There is no conversion for that... -_-
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
09 Jan 2010 10:13 AM
Its a type of Vector2. Its for GUIs positions, sizes and stuff like that.
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
09 Jan 2010 10:13 AM
@king:

It is NOT a Vector2... Don't put the two together.
Report Abuse
bobob55 is not online. bobob55
Joined: 24 Jul 2008
Total Posts: 4522
09 Jan 2010 10:14 AM
Oh ok, so it has to do with GUIs?
Report Abuse
Xtreme101 is not online. Xtreme101
Joined: 03 Jan 2009
Total Posts: 4385
09 Jan 2010 10:17 AM
Two Dementional Objects. remove the z or x factor? Lol?
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
09 Jan 2010 10:18 AM
The size and position and all that.
It looks like this: (Position property of GUI)

Position | {.4, .3} {0, 0}


The first one is scale (i think) which compares it to the size of the screen, 1 being the whole screen. The second table is the offset. Thats where you can manually change the size to EXACTLY how you want (measured in pixels, i belive). Usually, if one table has something other than 0s, the other table has both 0s.
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
09 Jan 2010 10:19 AM
@King:

Offset can't have fractional values. You gave the X Offset a fractional value...
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
09 Jan 2010 10:20 AM
i thought that was scale, the first table...
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
09 Jan 2010 10:20 AM
And Scale isn't always based on SCREEN SIZE. It is always based in it's carrier's AbsoluteSize/Position...
Report Abuse
trappingnoobs is not online. trappingnoobs
Joined: 05 Oct 2008
Total Posts: 19100
09 Jan 2010 10:20 AM
But I mean, if I were to try, which I am, to make a game, where you can right click on stuff to make menu's pop up like fight and all that, how would I say

script.Parent.whateverGUI'sPositioniscalled = script.Parent.Parent.Parent.Mouse.Target

how could I do that? It would obviously be in a tool, but its just an example of what I want it to do
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
09 Jan 2010 10:21 AM
@king:

They aren't tables... That is the way the __tostring metamethod shows it. They are USERDATA, just like Vector3 and Vector2 and UDim (which is what X and Y are) and Faces.
Report Abuse
trappingnoobs is not online. trappingnoobs
Joined: 05 Oct 2008
Total Posts: 19100
09 Jan 2010 10:22 AM
I only use the values marked -

{-.0}, {-,0}

I find them easy enough to use, except the decimal part where they never go to what decimal you want is annoying, instead of 0.5 it goes to 0.49999999999999 etc.
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
09 Jan 2010 10:23 AM
@trapping:

Not a big deal, seeing as it can only go to 12 decimal places.
Report Abuse
trappingnoobs is not online. trappingnoobs
Joined: 05 Oct 2008
Total Posts: 19100
09 Jan 2010 10:26 AM
yeah but its a lot more neat when it stays where you ask it to.

anyway, how can I say

script.Parent.MouseButton1Down:connect(function(clicked)
if clicked.Name == "Zombie" then
game.Players[script.Parent.Parent.Name].PlayerGUI.ScreenGui.ZombieMenu.Visible = true
game.Players[script.Parent.Parent.Name].PlayerGUI.ScreenGui.ZombieMenu.Position = UDIM2.new{how do I set it to be wherever he clicked?, 0}, {0,0}
end
end)
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
09 Jan 2010 10:28 AM
The event 'MouseButton1Down' returns X and Y. What the heck is 'clicked'?
Report Abuse
trappingnoobs is not online. trappingnoobs
Joined: 05 Oct 2008
Total Posts: 19100
09 Jan 2010 10:33 AM
the argument. I thought it was what you clicked on

*returns to fail hole nd sits down in the fail corner*
Report Abuse
nightname is not online. nightname
Joined: 10 Jun 2008
Total Posts: 8960
09 Jan 2010 10:40 AM
@Blocco

i have converted Vector3 to Udim2... The problem is it only works depending on the size of the baseplate. If i can remember the forumla...

It was something like.

Frame.Size = UDim2.new{0, game.Workspace.Baseplate.Size/2, 0, game.Workspace.Baseplate.Size/2}


I am not 100% sure... Maybe i can find it somewhere....
Report Abuse
LEG0builder is not online. LEG0builder
Joined: 06 Jun 2008
Total Posts: 3188
09 Jan 2010 10:47 AM
game.Workspace.Base.Size = (512,0.4,512) -- in most cases
game.Workspace.Base.Size/2 = (256,0.2,256) --???
Report Abuse
XlegoX is not online. XlegoX
Joined: 16 Jun 2008
Total Posts: 14955
09 Jan 2010 10:52 AM
There is no way to convert from a Vector3 to a UDim2, as there is no logical conversion between them.
Report Abuse
nightname is not online. nightname
Joined: 10 Jun 2008
Total Posts: 8960
09 Jan 2010 10:53 AM
Nah. I told you i can not remember the forumla.

If the baseplate size is equal to 500, then it divides it by 2. If its like 750 then it divides it by 3. This is because the frame size always has to be 250. So the bigger the baseplate the more it divides.
Report Abuse
trappingnoobs is not online. trappingnoobs
Joined: 05 Oct 2008
Total Posts: 19100
09 Jan 2010 11:15 AM
is hewre any way of placing a GUI wherever you clicked, like a right click menu
Report Abuse
GR33NTHUNDAH is not online. GR33NTHUNDAH
Joined: 11 Aug 2010
Total Posts: 14311
02 Aug 2013 12:07 PM
howdy there

Mmph mmmph mph-mph mmph mmmmph!
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