jd678
|
  |
| Joined: 18 Apr 2008 |
| Total Posts: 11529 |
|
|
| 16 Aug 2013 09:06 PM |
Script:
dist = 10
while true do wait(1) --print("Loop Working") local p = game.Players:GetChildren() for i,p in pairs (p) do if p.Character then if (p[i].Character.Torso.Position - workspace.Part.Position < dist) then --ERROR ON THIS LINE p.Character.Humanoid.Health = 0 else p.Character.Humanoid.Health = 100 end end end end
Error:
22:03:37.123 - 1 is not a valid member of Player line 9 |
|
|
| Report Abuse |
|
|
Desperian
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 3371 |
|
|
| 16 Aug 2013 09:07 PM |
if (p.Character.Torso.Position - workspace.Part.Position < dist) then
|
|
|
| Report Abuse |
|
|
LV1Z
|
  |
| Joined: 23 Jul 2011 |
| Total Posts: 652 |
|
|
| 16 Aug 2013 09:15 PM |
^
p is not taken from a table so it doesn't need the [i] |
|
|
| Report Abuse |
|
|
jd678
|
  |
| Joined: 18 Apr 2008 |
| Total Posts: 11529 |
|
|
| 16 Aug 2013 09:43 PM |
| ah derp, I forgot that I deleted the table. |
|
|
| Report Abuse |
|
|
jd678
|
  |
| Joined: 18 Apr 2008 |
| Total Posts: 11529 |
|
|
| 16 Aug 2013 10:13 PM |
Now I get a new error:
dist = 10
while true do wait(1) --print("Loop Working") local p = game.Players:GetChildren() for i,p in pairs (p) do if p.Character then if (p.Character.Torso.Position - workspace.Part.Position < dist) then --ERROR ON THIS LINE p.Character.Humanoid.Health = 0 else p.Character.Humanoid.Health = 100 end end end end
Output:
22:52:39.174 - Workspace.CheckScript:9: attempt to compare userdata with number 22:52:39.174 - Script "Workspace.CheckScript", Line 9 |
|
|
| Report Abuse |
|
|
jd678
|
  |
| Joined: 18 Apr 2008 |
| Total Posts: 11529 |
|
| |
|