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
 

Table.Remove? [Halpo Logico Error]

Previous Thread :: Next Thread 
cxcharlie is not online. 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
VanillaLight is not online. VanillaLight
Joined: 02 Nov 2013
Total Posts: 834
12 Jan 2014 02:58 PM
table[yourvalue] = nil






























idk
Report Abuse
VanillaLight is not online. VanillaLight
Joined: 02 Nov 2013
Total Posts: 834
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 is not online. 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 is not online. 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
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