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: Trouble with tables

Previous Thread :: Next Thread 
MrLisawsome is not online. MrLisawsome
Joined: 18 Jan 2010
Total Posts: 3606
18 Apr 2014 01:05 PM
What I'm trying to do is add get all of the parts in a model to a table, and save all of their CFrame values to a table. Then, I want to change all of the parts' CFrame values, relative to their original saved values.

This almost works, except it thinks they should all be relative to a single part, instead of themselves.

In this case, the Torso. All of the limbs are moved relative to the Torso's original position, instead of their own original positions. They should move relative to their own.

No output, the script is functional, but not in the right way.

faf = script.Parent:GetChildren()

cframetable = {}

for w = 1,#faf do

if faf[w]:IsA("Part") then

table.insert(cframetable,#faf,faf[w].CFrame)


end
end


for v = 1,20 do

wait(0.01)

for i = 1, #faf do

if faf[i]:IsA("Part") then


faf[i].CFrame = cframetable[#faf] * CFrame.fromEulerAnglesXYZ(math.random(-5,5)/50,math.random(-5,5)/50,math.random(-5,5)/50)

end

end

end

Report Abuse
MrLisawsome is not online. MrLisawsome
Joined: 18 Jan 2010
Total Posts: 3606
18 Apr 2014 02:09 PM
Bump.
Report Abuse
MrLisawsome is not online. MrLisawsome
Joined: 18 Jan 2010
Total Posts: 3606
18 Apr 2014 02:48 PM
Is there something else I need to post?
Report Abuse
MrLisawsome is not online. MrLisawsome
Joined: 18 Jan 2010
Total Posts: 3606
18 Apr 2014 04:11 PM
Bump? ._.
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
18 Apr 2014 04:13 PM
table.insert(cframetable,faf[w].CFrame)

Report Abuse
spearman2 is not online. spearman2
Joined: 28 May 2010
Total Posts: 2938
18 Apr 2014 04:13 PM
table.insert(tostring(cframetable,#faf,faf[w].CFrame))

Making it a string...could probably help...or make things worse.
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
18 Apr 2014 04:15 PM
for I,v in pairs(faf) do
if v:IsA("Part") then
v.CFrame = cframetable[v.CFrame] * CFrame.fromEulerAnglesXYZ(math.random(-5,5)/50,math.random(-5,5)/50,math.random(-5,5)/50)
end
end


not entirely sure
Report Abuse
MrLisawsome is not online. MrLisawsome
Joined: 18 Jan 2010
Total Posts: 3606
18 Apr 2014 04:40 PM
@island your suggestion gives me this error:

14:39:51.314 - Workspace.animatedscene1.1.Script:19: bad argument #1 to '?' (CFrame expected, got nil)
Report Abuse
MrLisawsome is not online. MrLisawsome
Joined: 18 Jan 2010
Total Posts: 3606
18 Apr 2014 04:44 PM
@spearman It obviously just wants a table, not a string.

14:43:43.706 - Workspace.animatedscene1.1.Script:9: bad argument #1 to 'insert' (table expected, got string)
Report Abuse
MrLisawsome is not online. MrLisawsome
Joined: 18 Jan 2010
Total Posts: 3606
18 Apr 2014 06:48 PM
Bump.
Report Abuse
MrLisawsome is not online. MrLisawsome
Joined: 18 Jan 2010
Total Posts: 3606
18 Apr 2014 09:17 PM
Bump :l
Report Abuse
MrLisawsome is not online. MrLisawsome
Joined: 18 Jan 2010
Total Posts: 3606
18 Apr 2014 11:24 PM
Ehh...
Report Abuse
MrLisawsome is not online. MrLisawsome
Joined: 18 Jan 2010
Total Posts: 3606
20 Apr 2014 12:33 PM
BUMP...
Report Abuse
MrLisawsome is not online. MrLisawsome
Joined: 18 Jan 2010
Total Posts: 3606
20 Apr 2014 01:09 PM
argh
Report Abuse
Spongocardo is not online. Spongocardo
Joined: 06 Sep 2008
Total Posts: 2843
20 Apr 2014 01:12 PM
What are you trying to accomplish, a feature that saves your position, and loads it when you rejoin?

Here's my siggy... Done.
Report Abuse
transIate is not online. transIate
Joined: 20 Jun 2013
Total Posts: 2699
20 Apr 2014 01:14 PM
sorry your script is too spread apart ):
Report Abuse
MrLisawsome is not online. MrLisawsome
Joined: 18 Jan 2010
Total Posts: 3606
20 Apr 2014 01:20 PM
What I'm trying to do is save each part's CFrame to a table, and then move them all, relative to the saved values.
Report Abuse
Spongocardo is not online. Spongocardo
Joined: 06 Sep 2008
Total Posts: 2843
20 Apr 2014 01:22 PM
What do you need that for exactly? I don't quite understand what this would be useful for.

Here's my siggy... Done.
Report Abuse
MrLisawsome is not online. MrLisawsome
Joined: 18 Jan 2010
Total Posts: 3606
20 Apr 2014 01:27 PM
It's for a video. I'm animating characters with scripting in some of it. This particular part needs the character to shiver, sort of. I know it would look weird, but that's pretty much the point.
Report Abuse
MrLisawsome is not online. MrLisawsome
Joined: 18 Jan 2010
Total Posts: 3606
20 Apr 2014 01:54 PM
Bump..
Report Abuse
Spongocardo is not online. Spongocardo
Joined: 06 Sep 2008
Total Posts: 2843
20 Apr 2014 01:58 PM
Try using the ToObjectSpace method of a CFrame:
http://wiki.roblox.com/index.php?title=CFrame#Methods

Here's my siggy... Done.
Report Abuse
MrLisawsome is not online. MrLisawsome
Joined: 18 Jan 2010
Total Posts: 3606
20 Apr 2014 02:03 PM
I don't know what you're trying to say there. I already have a method of animating. This shivering bit already -almost- works. The table is the problem.

I need to read each part's unique CFrame from the table, to have the center point for each part to move the CFrame relative to.

I know this can work, it moves them relative to the Torso as of now, but if they all were relative to their own saved CFrame values, then it would work and I would be on my way.
Report Abuse
wantedfunnybunny is not online. wantedfunnybunny
Joined: 10 Apr 2012
Total Posts: 466
20 Apr 2014 02:11 PM
Try adding it to a string?
Report Abuse
MrLisawsome is not online. MrLisawsome
Joined: 18 Jan 2010
Total Posts: 3606
20 Apr 2014 02:17 PM
Spearman2 suggested that but his snippet of code for it only caused an error when I implemented it.

How else could I use a string for this?
Report Abuse
MrLisawsome is not online. MrLisawsome
Joined: 18 Jan 2010
Total Posts: 3606
20 Apr 2014 02:49 PM
I'm on to something with strings but I know I'm doing it the long way.. WAY long way...
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