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 » Scripting Helpers
Home Search
 

Re: Need help with Output error:

Previous Thread :: Next Thread 
jd678 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. jd678
Joined: 18 Apr 2008
Total Posts: 11529
16 Aug 2013 10:24 PM
nvm ima derp

[SOLVED]
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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