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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 02 Nov 2013 |
| Total Posts: 677 |
|
| |
|
|
| 25 May 2015 10:51 AM |
Erps.
-𝒩 | Anticodist, Scripter |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 25 May 2015 10:58 AM |
'even then it is a roblox only problem.' no comment... |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|