cxcharlie
|
  |
| Joined: 26 Aug 2009 |
| Total Posts: 1414 |
|
|
| 12 Jan 2014 02:57 PM |
How do I remove something from a table if I do this? (Go to the indicated part with the "**") At the ** part, how do I remove the player out of the table? If i just do table.remove(alive,v) it will: "number expected, got userdata" So is there a way I can get it out of the table? Thanks in advanced
local bind=script.Parent:WaitForChild('ReturnWinners') local part=script.Parent:WaitForChild('Part')
function getPlaying() local p={} for _,v in pairs(game:GetService('Players'):GetPlayers()) do if v:FindFirstChild('Spectating')~=nil then if v.Spectating.Value==false then if v.Character~=nil then if v.Character.Humanoid.Health>0 then table.insert(p,v) end end end end end return p end local alive={} alive=getPlaying() for _,v in pairs(alive) do if v.Character~=nil then if v.Character:FindFirstChild('Humanoid') then v.Character:MoveTo(part.Position+Vector3.new(math.random(-part.Size.x/2,part.Size.x/2),0,math.random(-part.Size.z/2,part.Size.z/2))) v.Character.Humanoid.Died:connect(function() ** end) end end end |
|
|
| Report Abuse |
|
|
| |
|
|
| 12 Jan 2014 02:59 PM |
Just kidding table.remove() does work, simply using the table and the value for the arguments
t = {yourmom = 5, honey = "bees", foo = 47457834}
table.remove(t,yourmom) |
|
|
| Report Abuse |
|
|
cxcharlie
|
  |
| Joined: 26 Aug 2009 |
| Total Posts: 1414 |
|
|
| 12 Jan 2014 02:59 PM |
:P the problem is that i don't know how to find the index of that table... oh wait... ._. lemme try |
|
|
| Report Abuse |
|
|
F7D
|
  |
| Joined: 11 Jan 2014 |
| Total Posts: 65 |
|
|
| 12 Jan 2014 03:01 PM |
I do believe that script is to long to get help, How to use table.remove is you need the 'number' of which part it is in a table, How I would set up a function for it function GetId(Search,What) for i=1,#Search do if Search[i] = What then return i end end end or something like that, for i,v in pairs would not always work in this case since if you used "something = 'Something'" it would return something. |
|
|
| Report Abuse |
|
|