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
 

What are the prev and Children[i] values?

Previous Thread :: Next Thread 
Splashforce is not online. Splashforce
Joined: 05 Jun 2008
Total Posts: 3566
21 Jun 2016 01:19 PM
So I'm working on a weld script (incomplete) from stuff I'm learning on the wikis and from models I've inspected, and I noticed that when stating the classnames I'm supposed to put a [i] and use a local prev, which I can't find anything on. Can anyone explain what these are? This is the script.

-------------------------------
local Children = script.Parent:GetChildren()

for i = 1,#Children do
if ((Children[i].className == "Part") or (Children[i].className == "Wedge") or (Children[i].className == "Handle") or (Children[i].className == "Hitbox")) then
print("Parts have been registered.")
end
end
-------------------------------


Report Abuse
DevVince is not online. DevVince
Joined: 08 Nov 2008
Total Posts: 9245
21 Jun 2016 01:22 PM
for _,part in pairs(script.Parent:GetChildren()) do
if part:IsA'BasePart' then
print(part.Name, ' is a part.')
end
end
Report Abuse
Splashforce is not online. Splashforce
Joined: 05 Jun 2008
Total Posts: 3566
21 Jun 2016 03:17 PM
Ok, sorry, I think I phrased that wrong. What I mean is why is local prev put into the local values if it doesn't equal anything. I know it works, I just don't know why so I can apply it late. Also, why do I need to for [i] between the Children and className for the script to work? Here's a bit of an updated but still incomplete version of the script.

----------------------------------
local PREV
local Children = script.Parent:GetChildren()
local Part = script.Parent.Part
local Wedge = script.Parent.Wedge
local Hitbox = script.Parent.Hitbox
local Handle = script.Parent.Handle

for i = 1,#Children do
if ((Children[i].className == "Part") or (Children[i].className == "Wedge") or (Children[i].className == "Handle") or (Children[i].className == "Hitbox")) then
if (prev ~= nil) then

end
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