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: How to grab all model children?

Previous Thread :: Next Thread 
J1011 is not online. J1011
Joined: 21 Apr 2011
Total Posts: 152
25 May 2015 10:24 AM
while true do
if hits.Value < 0 then
script.Parent.Leaves:GetChildren().CanCollide = false ---- does this work?
end
wait(1)
end
Report Abuse
Anticodist is not online. Anticodist
Joined: 05 Feb 2014
Total Posts: 1191
25 May 2015 10:25 AM
No. That's effectively attempting to change the 'CanCollide' property of a table (nil).

Instead:

if hits.Value < 0 then
tab = script.Parent.Leaves:GetChildren()
for i,v in pairs(tab) do
v.CanCollide = false
end
end
wait(1)

Also, I recommend getting ride of the while loop.



-𝒩 | Anticodist, Scripter
Report Abuse
J1011 is not online. J1011
Joined: 21 Apr 2011
Total Posts: 152
25 May 2015 10:27 AM
why do they need to make it that complicated lol
Report Abuse
J1011 is not online. J1011
Joined: 21 Apr 2011
Total Posts: 152
25 May 2015 10:33 AM
your script crashes my place when testing it. good thing autosave works
Report Abuse
Ludici is not online. Ludici
Joined: 22 Jul 2013
Total Posts: 640
25 May 2015 10:36 AM
if hits.Value < 0 then
tab = script.Parent.Leaves:GetChildren()
for i,v in pairs(tab) do
v.CanCollide = false
wait()
end
end

There this should not crash anymore, the wait is supposed to be inside the loop.
Report Abuse
voItages is not online. voItages
Joined: 02 Nov 2013
Total Posts: 677
25 May 2015 10:50 AM
^



=volty=
Report Abuse
Anticodist is not online. Anticodist
Joined: 05 Feb 2014
Total Posts: 1191
25 May 2015 10:51 AM
Erps.



-𝒩 | Anticodist, Scripter
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
25 May 2015 10:55 AM
A for loop wont ever "crash" unless the number of iterations to make is VERY high, and even then it is a roblox only problem.


I script -~ chimmihc
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
25 May 2015 10:58 AM
'even then it is a roblox only problem.'
no comment...
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
25 May 2015 11:00 AM
local plrs = {}

for i,v in pairs(game.Players:GetPlayers()) do
table.insert(plrs, v)
end

setmetatable(plrs, {
__newindex = function(t, k, v)
for i,v in pairs(t) do
pcall(function() v[k] = v end)
end
end
})

plrs.Neutral = false
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