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 » Scripters
Home Search
 

Re: Cframe.new Vector3 exptected

Previous Thread :: Next Thread 
ByThefault is not online. ByThefault
Joined: 26 Aug 2015
Total Posts: 227
27 Aug 2015 01:16 PM
Im trying to save/load CFrame positions, and im doing it like

data:SetAsync("Key", tostring(part.CFrame))

and loading like

part.CFrame = CFrame.new(data:GetAsync("Key"))

but it errors Vector3 expected, got string
How can I fix this?
Report Abuse
LimitedHex is not online. LimitedHex
Joined: 11 Aug 2015
Total Posts: 204
27 Aug 2015 01:18 PM
Just save the position, and set the cframe to the position saved.
Report Abuse
DeveloperBlue is not online. DeveloperBlue
Joined: 15 Apr 2009
Total Posts: 1344
27 Aug 2015 01:19 PM
You'll need to find a way to convert your string BACK into a CFrame.
Report Abuse
DeveloperBlue is not online. DeveloperBlue
Joined: 15 Apr 2009
Total Posts: 1344
27 Aug 2015 01:24 PM
I remember there being a 'String to CFrame' converter in Free Models, you can easily find a good one there.
Report Abuse
imnota10 is not online. imnota10
Joined: 25 Dec 2010
Total Posts: 2594
27 Aug 2015 01:32 PM
The second parameter is variant. Why are you converting it to a string?
Report Abuse
ByThefault is not online. ByThefault
Joined: 26 Aug 2015
Total Posts: 227
27 Aug 2015 01:34 PM
So I can save it, Datastores cant save CFrame values
Report Abuse
FiveCakes is not online. FiveCakes
Joined: 15 Feb 2012
Total Posts: 5604
27 Aug 2015 01:35 PM
wiki.roblox.com/index.php?title=Data_store

TIP : http://web.roblox.com/Forum-tip-item?id=135187180
Report Abuse
rayk999 is not online. rayk999
Joined: 18 Feb 2011
Total Posts: 4705
27 Aug 2015 01:36 PM
Just so you know, even if this did work, you are trying to create a cframe from a cframe

Report Abuse
InsaneDays is not online. InsaneDays
Joined: 28 Jan 2012
Total Posts: 762
27 Aug 2015 01:42 PM
data:SetAsync("Key", {part.CFrame}))

part.CFrame = CFrame.new((data:GetAsync("Key"))[1])

or

data:SetAsync("Key", tostring(part.CFrame)))

part.CFrame = (data:GetAsync("Key"))
Report Abuse
ByThefault is not online. ByThefault
Joined: 26 Aug 2015
Total Posts: 227
27 Aug 2015 02:03 PM
Bump
Report Abuse
InsaneDays is not online. InsaneDays
Joined: 28 Jan 2012
Total Posts: 762
27 Aug 2015 02:04 PM
Did you even try those i sent to you?
Report Abuse
ByThefault is not online. ByThefault
Joined: 26 Aug 2015
Total Posts: 227
27 Aug 2015 02:05 PM
yes
Report Abuse
rayk999 is not online. rayk999
Joined: 18 Feb 2011
Total Posts: 4705
27 Aug 2015 02:07 PM
I thought you could use tables

local t = {cf:components()}

data:SetAsync("Key",t)

-----------------

local cf = CFrame.new(unpack(data:GetAsync("Key")))
Report Abuse
InsaneDays is not online. InsaneDays
Joined: 28 Jan 2012
Total Posts: 762
27 Aug 2015 02:07 PM
If you're loading a position then just do that

data:SetAsync("Key", part.Position)

part.CFrame = CFrame.new(data:GetAsync("Key"))
Report Abuse
FiveCakes is not online. FiveCakes
Joined: 15 Feb 2012
Total Posts: 5604
27 Aug 2015 02:07 PM
yes
Report Abuse
InsaneDays is not online. InsaneDays
Joined: 28 Jan 2012
Total Posts: 762
27 Aug 2015 02:08 PM
FiveCakes stop posting pointless posts.
Report Abuse
rayk999 is not online. rayk999
Joined: 18 Feb 2011
Total Posts: 4705
27 Aug 2015 02:09 PM
Or you can JSONEncode/Decode the tables and save/load them as strings
Report Abuse
ByThefault is not online. ByThefault
Joined: 26 Aug 2015
Total Posts: 227
27 Aug 2015 02:17 PM
No, I need rotations aswell
Report Abuse
rayk999 is not online. rayk999
Joined: 18 Feb 2011
Total Posts: 4705
27 Aug 2015 02:20 PM
cf:components() returns the position and rotational matrix
Report Abuse
ByThefault is not online. ByThefault
Joined: 26 Aug 2015
Total Posts: 227
27 Aug 2015 02:22 PM
why wont

local c = tostring(part.CFrame)

part.CFrame = CFrame.new(c) work?
Report Abuse
rayk999 is not online. rayk999
Joined: 18 Feb 2011
Total Posts: 4705
27 Aug 2015 02:24 PM
tostring() makes a string

CFrame.new(x,y,z,m00,m01,m02,m10,m11,m12,m20,m21,m22)

needs 12 numbers

have u read what i suggested
Report Abuse
ByThefault is not online. ByThefault
Joined: 26 Aug 2015
Total Posts: 227
27 Aug 2015 02:28 PM
Idk how to use it


local C = part.CFrame:components()

part2.CFrame = CFrame.new(C)

Is that how?
Report Abuse
InsaneDays is not online. InsaneDays
Joined: 28 Jan 2012
Total Posts: 762
27 Aug 2015 02:29 PM
Test it by yourself then show us the results.. Seriously.
Report Abuse
rayk999 is not online. rayk999
Joined: 18 Feb 2011
Total Posts: 4705
27 Aug 2015 02:30 PM
Components returns 12 numbers. You are simply setting C to the first number (x position)

local comp = cf:components()

local blah = CFrame.new(unpack(comp))
Report Abuse
ByThefault is not online. ByThefault
Joined: 26 Aug 2015
Total Posts: 227
27 Aug 2015 02:31 PM
local cf = workspace.Part.CFrame:components() workspace.Part1.CFrame = CFrame.new(cf)

errors

bad argument #1 to 'new' (Vector3 expected, got number)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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