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: Vectors, Positioning

Previous Thread :: Next Thread 
lego555444 is not online. lego555444
Joined: 21 Sep 2008
Total Posts: 1383
03 Apr 2013 05:56 PM
Does anyone have a plugin or script that quickly gathers all the vectors and position of the bricks in a certain model and puts it in a neat notepad or file?
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
03 Apr 2013 06:14 PM
Hehe run in command bar and copy them from the output.

local Model = Workspace.Thing

local Banana = print()
local Vec = {};
for_,n in next,Model:GetChildren() do
if n:IsA("Part") then
table.insert(Vec,n.Name.." "..v.Position)
end
end
for _,n in next,Vec do
print(n)
end
Report Abuse
lego555444 is not online. lego555444
Joined: 21 Sep 2008
Total Posts: 1383
03 Apr 2013 06:24 PM
thank you
Report Abuse
lego555444 is not online. lego555444
Joined: 21 Sep 2008
Total Posts: 1383
03 Apr 2013 06:27 PM
Um kind of confused which parts do I edit?
Report Abuse
lego555444 is not online. lego555444
Joined: 21 Sep 2008
Total Posts: 1383
03 Apr 2013 06:28 PM

16:28:52.131 - Error in script: '=' expected near 'in'
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
03 Apr 2013 06:33 PM
Thats odd...Delete the banana line...it is not needed.

Hmm whats the problem
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
03 Apr 2013 06:33 PM
All you have to change is the variable Model
Report Abuse
dog456pop248 is not online. dog456pop248
Joined: 24 Aug 2008
Total Posts: 3977
03 Apr 2013 06:34 PM

local Banana = print()
local Vec = {}
for_,n in pairs(game.Workspace:GetChildren()) do -- This will return any parts in workspace, if you are looking for parts in a model, use game.Workspace.ModelName instead--
if n:IsA("Part") then
table.insert(Vec,n.Name.." "..v.Position)
end
end
for _,n in next,Vec do
print(n)
end
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
03 Apr 2013 06:34 PM
Ahaha i forgot a space in it.

local Model = Workspace.Thing



local Vec = {};
for _,n in next,Model:GetChildren() do
if n:IsA("Part") then
table.insert(Vec,n.Name.." "..v.Position)
end
end
for _,n in next,Vec do
print(n)
end
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
03 Apr 2013 06:35 PM
dog all you did is steel my script and change one line...not fixing the error.
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
03 Apr 2013 06:36 PM
and using pairs is not different than using next. They perform the same thing just different functions. Actually pairs uses next as its iterator. So technically using next is more efficient :P
Report Abuse
lego555444 is not online. lego555444
Joined: 21 Sep 2008
Total Posts: 1383
03 Apr 2013 06:37 PM
Output
16:36:29.547 - local Model = Workspace.Model



local Vec = {};
for _,n in:8: attempt to index global 'v' (a nil value)
16:36:29.548 - Script "local Model = Workspace.Model



local Vec = {};
for _,n in", Line 8
16:36:29.548 - stack end
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
03 Apr 2013 06:38 PM
Sorry another stupid mistake.

local Model = Workspace.Thing



local Vec = {};
for _,n in next,Model:GetChildren() do
if n:IsA("Part") then
table.insert(Vec,n.Name.." "..n.Position)
end
end
for _,n in next,Vec do
print(n)
end
Report Abuse
dog456pop248 is not online. dog456pop248
Joined: 24 Aug 2008
Total Posts: 3977
03 Apr 2013 06:42 PM
I don't think I 'stole' your script. I tried to make it easier to understand. And my preferred way is using pairs.
Report Abuse
lego555444 is not online. lego555444
Joined: 21 Sep 2008
Total Posts: 1383
03 Apr 2013 06:43 PM
16:43:38.916 - local Model = Workspace.Model


local Vec = {};
for _,n in :7: attempt to concatenate field 'Position' (a userdata value)
16:43:38.917 - Script "local Model = Workspace.Model


local Vec = {};
for _,n in ", Line 7
16:43:38.917 - stack end
Report Abuse
dog456pop248 is not online. dog456pop248
Joined: 24 Aug 2008
Total Posts: 3977
03 Apr 2013 06:45 PM
if n:IsA("BasePart") then
Report Abuse
dog456pop248 is not online. dog456pop248
Joined: 24 Aug 2008
Total Posts: 3977
03 Apr 2013 06:48 PM
Also, line 8 is erroring because you can't turn a Vector3 value into a string value.
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
03 Apr 2013 06:50 PM
That is not the problem. The problem is that i am trying to concentrate a Vector3 value not a string.


local Model = Workspace



local Vec = {};
local Format = "%s %d,%d,%d"
for _,n in next,Model:GetChildren() do
if n:IsA("Part") then
table.insert(Vec,Format:format(n.Name,n.Position.X,n.Position.Y,n.Position.Z))
end
end
for _,n in next,Vec do
print(n)
end
Report Abuse
dog456pop248 is not online. dog456pop248
Joined: 24 Aug 2008
Total Posts: 3977
03 Apr 2013 06:50 PM
Fixed it. This script will find any parts in workspace.
local Model = Workspace



local Vec = {};
for _,n in next,Model:GetChildren() do
if n:IsA("Part") then
table.insert(Vec,n.Name.."is at ("..n.Position.X.. ", " ..n.Position.Y.. ", " ..n.Position.Z..")")
end
end
for _,n in next,Vec do
print(n)
end
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
03 Apr 2013 06:50 PM
dog why is it that you have been around since 2008 and i know more scripting than you?
Report Abuse
dog456pop248 is not online. dog456pop248
Joined: 24 Aug 2008
Total Posts: 3977
03 Apr 2013 06:51 PM
^^ Oops, didn't refresh page.
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
03 Apr 2013 06:51 PM
I just fixed it...Sigh...and usuing :IsA("BasePart") is NOT needed.
Report Abuse
dog456pop248 is not online. dog456pop248
Joined: 24 Aug 2008
Total Posts: 3977
03 Apr 2013 06:52 PM
Well, I've only started scripting in january. Also, I haven't really looked into string manipulation.
Report Abuse
dog456pop248 is not online. dog456pop248
Joined: 24 Aug 2008
Total Posts: 3977
03 Apr 2013 06:53 PM
Alrighty, this thread is done.
I posted my script after yours because I hadn't refreshed the page, so your reply wasn't there when I posted mine.
You know more than me because you've been scripting longer.
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
03 Apr 2013 06:53 PM
I love string matching/patterns and manipulation :D

local msg = "#BOO This shall not print!!!"
print(msg:match("^#.-%w)
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