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: why did taking a object's position and-

Previous Thread :: Next Thread 
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
02 Aug 2013 12:32 PM
translating it to a string make it result in UserData(AEASD323) -- or some other UserDate Value

I do not know if i matters but here is my code:

while true do wait(0.03)
local up1 = gui2.p1.Hold


up1.Value = "UDim2.new("..gui2.p1.Position.X..","..gui2.p1.Position.Y..")"
wait(0.03)end
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
02 Aug 2013 12:40 PM
I should rephrase how can I change a userdata value into a string.
Report Abuse
wafles26122 is not online. wafles26122
Joined: 14 Jun 2010
Total Posts: 958
02 Aug 2013 12:42 PM
What exactly are you trying to do.... What user data value are you trying to turn into a string?
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
02 Aug 2013 12:43 PM
The userdata value Position.
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
02 Aug 2013 12:43 PM
tostring()--?
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
02 Aug 2013 12:47 PM
It just makes the string userdata: 13BBF090 or the same thing with a different letter/number sequence on the second half.
Report Abuse
wafles26122 is not online. wafles26122
Joined: 14 Jun 2010
Total Posts: 958
02 Aug 2013 12:48 PM
I'm confused.... Why are you trying to convert a udim2 to a string?
Report Abuse
As8D is online. As8D
Joined: 24 Dec 2009
Total Posts: 2907
02 Aug 2013 12:48 PM
Userdatas act like Tables from what I understand.

Though not all userdatas return 'userdata: hex' when printing, some do. Ex, Vector3 returns X Y Z when printed.


The 'hex' part of the output you get is the hexdecimal address...


ALSO! If you want to turn... I guess I got all data types except instances... into strings and back again, you can use my toString and toData functions.

Do not use the model I'm sending you below, but take out the toString and toData functions, as they should work 100%.

http://www.roblox.com/Instance-to-string-String-to-instance-item?id=116408242


Example of turning UDim2.new(0.5, 100, 0, 1337) into a string:

print(toString(UDim2.new(0.5, 100, 0, 1337)))
> u2:0.5,100,0,1337


- As, hm, what was I about to do. Oh yes, turn brains to dust.
Report Abuse
iIikeyou is not online. iIikeyou
Joined: 07 Mar 2012
Total Posts: 1659
02 Aug 2013 12:49 PM
'UDim2.new('..obj.X.Scale..','..obj.X.Offset..','..obj.Y.Scale..','..obj.Y.Offset..')'
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
02 Aug 2013 12:51 PM
"I'm confused.... Why are you trying to convert a udim2 to a string?"

For my chat gui It will not let me compare the position of a text label to UDim2.new() so I wanted to improvise.
Report Abuse
BJCarpenter is online. BJCarpenter
Joined: 04 Nov 2008
Total Posts: 4416
02 Aug 2013 01:01 PM
Here's how I .Name a Part, a Vector3 Value:

.
.
.
local HexName = Vector3.new(1,1,1) -- Follow this Var
local face = 1 -- THIS
local yName = 1 -- THIS
local xName = 1 -- & THIS
local yPrime = .1
local xPrime = .1

local Globe = Instance.new("Model", Workspace)

function cubeToSphere(x,y,z)
return Vector3.new(
x*math.sqrt(1-y^2/2-z^2/2+(y^2*z^2)/3),
y*math.sqrt(1-z^2/2-x^2/2+(x^2*z^2)/3),
z*math.sqrt(1-x^2/2-y^2/2+(x^2*y^2)/3)
);
end

function Draw(point)

Part = Instance.new("Part", Globe)
--if color == Color3.new(1,1,1) then
--Part.Shape = "Ball"
--end



Part.Size = PSize
HexName = Vector3.new(xName,yName,Face)
Part.Name = tostring(HexName)

local origin = CFrame.new(point,Vector3.new(0,0,0))
Part.CFrame = CFrame.new(point*1,Vector3.new(0,0,0))
Part.Anchored = true

Part.Transparency = 0
Part.BrickColor =BrickColor.new(color)

local r = math.random()
if r < 1 then --.1 then
for i = 1, #city do
local part = city[i]:Clone()


local rel = centerPoint:toObjectSpace(part.CFrame);
print(part)
part.CFrame = origin:toWorldSpace(rel);


part.Parent = Globe
part.Anchored = true
end -- Stamp parts

elseif r < 1 then
Part.Transparency = 1

end -- land?
Part.Transparency = 1
end -- draw

local t_height=240;--how high up it is, this does not change for a cube
local offset=0
for x = -10, 10, 1 do -- aND THIS, BUT I LOST THE PLOT AT THIS POINT....
xName = x
xPrime = x/10

if offset == 0 then
-- offset = .05
else
offset = 0
end -- offset flip


for y = -10, 10, 1 do
yName = y
yPrime = y/10 + offset

PSize = Vector3.new(14,16,1)
face = 1
if y < 10 and x < 10 then
Face = 1
color = Color3.new(0,0,0)
local sphere_point=cubeToSphere(xPrime, 1, yPrime);
Draw(sphere_point*t_height)
end
.
.
.
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