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
 

removing a player from a table

Previous Thread :: Next Thread 
sidekick601 is not online. sidekick601
Joined: 27 Feb 2012
Total Posts: 8734
24 Apr 2017 04:55 PM
say theres a playeradded where you get added into a table when you join the game but once you leave how would I remove the player from that table?
Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
24 Apr 2017 04:58 PM
GetPlayers()


Report Abuse
Wrathsong is online. Wrathsong
Joined: 05 Jul 2012
Total Posts: 22393
24 Apr 2017 05:30 PM
table.remove or just redefine the table as game.Players:GetPlayers()


Report Abuse
sidekick601 is not online. sidekick601
Joined: 27 Feb 2012
Total Posts: 8734
24 Apr 2017 06:11 PM
i was thinking that.. .PlayerRemoving then table.remove but it doesnt let me remove the player.. it says it was expecting a number
Report Abuse
Wrathsong is online. Wrathsong
Joined: 05 Jul 2012
Total Posts: 22393
24 Apr 2017 07:14 PM
you probably did table.remove(tab, player) you need to input a position in the table, and it seems your table's keys are integers and not objects (the player is an object). so just redefine it as game.Players:GetPlayers()


Report Abuse
sidekick601 is not online. sidekick601
Joined: 27 Feb 2012
Total Posts: 8734
24 Apr 2017 07:31 PM
redefine how? dont know how I would get :GetPlayers() in what im trying to do
Report Abuse
Disillusions is not online. Disillusions
Joined: 10 Jul 2011
Total Posts: 6365
24 Apr 2017 07:37 PM
local players = game.Players:GetPlayers() --keep using :GetPlayers() instead of removing the player


Report Abuse
sidekick601 is not online. sidekick601
Joined: 27 Feb 2012
Total Posts: 8734
24 Apr 2017 07:37 PM
ohh, thanks
Report Abuse
captainjet2c is not online. captainjet2c
Joined: 29 Jun 2013
Total Posts: 37
24 Apr 2017 07:50 PM
I have a possible solution, it might not be the best but it could be something. This will only make the player in your table nil, nil is a standard of removing an object from the table. Pretty much what you may be looking for.
-------------------------------------------------->> Script input
-- implementing removed child
-- "i" in the table is indicated for every object it has read passed.
-- "v" is the object, allowing you to edit it's properties and such.

--Tab is for the players added into your table

-------------------------------------------------->> Code

local tab = {"Players that were in your table"}

game.Players.ChildRemoved:connect(function(player)
for i,v in pairs(tab) do
if v == player.Name then -- if you gather the player itself, do v.Name
v = nil
tab.sort -- organizes your table, removing the player from the table.
-- removes the player from the table
else
-- add stuff, idk
end
end
end)
Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
24 Apr 2017 07:53 PM
That's exactly why you would want to use GetPlayers.


Report Abuse
captainjet2c is not online. captainjet2c
Joined: 29 Jun 2013
Total Posts: 37
24 Apr 2017 07:55 PM
Yeah ... lol
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