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: Need help with Stop Motion script

Previous Thread :: Next Thread 
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
13 Aug 2015 01:17 AM
So basically there is a folder in ServerStorage named Investiage, which has models in it.

These models are just one charcter with different arm positions etc
They are named like this

F1
F2
F3
F4

and so on,

I want to loop through the children of Investiage get the F1 model put it workspace, destroy it, get the next model which is F2 put it in workspace and so on.

I'm trying to figure out the most efficient way to do this isntead of having a 100 line script of trash.

Can anyone help?
Report Abuse
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
13 Aug 2015 01:22 AM
for i, v in pairs(game.ServerStorage:GetChildren())
if v:IsA("Model") then
if v.Name:sub(1, 1) == "F" then

end
end

I so far have this, but I want to add them in according to their number

F1
F2
F3
F4

I don't just want to add them all in.

So in this loop I want to

Get the next F in according to the number after the F

add the first F in
wait()
destroy the first f
add in the next F
wait()
destroy that f

and so on.

As I have said I'm trying to make it efficient.
Report Abuse
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
13 Aug 2015 02:07 AM
Bump.
Report Abuse
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
13 Aug 2015 07:23 AM
bump
Report Abuse
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
13 Aug 2015 07:31 AM
for i,v in next,game["ServerStorage"]["Investigage"]:GetChildren() do
if game["ServerStorage"]["Investigage"]:FindFirstChild("F"..i) then
v:Clone().Parent = workspace
end
end
Report Abuse
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
13 Aug 2015 07:32 AM
I don't think that will

Add F2 in
wait()
Destroy
Add F2 in
wait()
Destroy

and so on.
Report Abuse
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
13 Aug 2015 07:33 AM
for i,v in next,game["ServerStorage"]["Investigage"]:GetChildren() do
if game["ServerStorage"]["Investigage"]:FindFirstChild("F"..i) then
v:Clone().Parent = workspace
wait(1)
end
end


This will work. I tested it.
Report Abuse
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
13 Aug 2015 07:33 AM
I do see it adding them all in however based on the current index. but how fast does it iterate through a table.
Report Abuse
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
13 Aug 2015 07:34 AM
Thank you
Report Abuse
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
13 Aug 2015 07:36 AM
oh. If you are going for speed, do this.


for i = 1,#game["ServerStorage"]["Investigage"]:GetChildren() do
if game["ServerStorage"]["Investigage"]:FindFirstChild("F"..i) then
game["ServerStorage"]["Investigage"]["F"..i]:Clone().Parent = workspace
end
end
Report Abuse
HotmailPower is not online. HotmailPower
Joined: 06 Aug 2015
Total Posts: 12
13 Aug 2015 08:45 AM
If you would like Speed and efficiency:

local Investigage = game:GetService("ServerStorage"):WaitForChild("Investigage")
for i = 1,#Investigage:GetChildren() do
local F = Investigage:FindFirstChild("F"..i)
if F then
F:Clone().Parent = workspace
end
end
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