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: Function not removing player from table?

Previous Thread :: Next Thread 
badfitz99 is not online. badfitz99
Joined: 01 May 2010
Total Posts: 5854
28 Jun 2014 02:30 PM
(alive is a table, the function has been called and everything works except for the .Died function)
can anyone help?

firstcheck = function()
print("loaded")
for _, check in pairs(plrs) do
if check.PlayerGui.alive.Value == true then
table.insert(alive,check)
alive2 = table.getn(alive)
print(alive2)
else
table.remove(alive,check)
print(alive2)
check.Character.Humanoid.Died:connect(function()
table.remove(alive,check)
print(alive2)
end)
end
end
end

Report Abuse
badfitz99 is not online. badfitz99
Joined: 01 May 2010
Total Posts: 5854
28 Jun 2014 02:40 PM
b1
Report Abuse
badfitz99 is not online. badfitz99
Joined: 01 May 2010
Total Posts: 5854
28 Jun 2014 03:02 PM
b2
Report Abuse
VoltiCoil is not online. VoltiCoil
Joined: 20 Nov 2008
Total Posts: 1227
30 Jun 2014 09:33 AM
table.remove(alive,check) wrong

table.remove(alive,_) Correct.

You want to remove the number allocated to that plot on the table, not the name of it. think of _ as i:

firstcheck = function()
print("loaded")
for _, check in pairs(plrs) do
if check.PlayerGui.alive.Value == true then
table.insert(alive,check)
alive2 = table.getn(alive)
print(alive2)
else
table.remove(alive,_)
print(alive2)
check.Character.Humanoid.Died:connect(function()
table.remove(alive,_)
print(alive2)
end)
end
end
end

I've used a much more simpler method but we'll stick with yours.
Report Abuse
badfitz99 is not online. badfitz99
Joined: 01 May 2010
Total Posts: 5854
30 Jun 2014 10:19 AM
16:18:27.657 - Workspace.check_if_alive:9: bad argument #1 to 'insert' (table expected, got userdata)
16:18:27.657 - Script 'Workspace.check_if_alive', Line 9 - global firstcheck
16:18:27.657 - Script 'Workspace.check_if_alive', Line 46
16:18:27.657 - Stack End

table.insert(alive,check)

alive is a real table.
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