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: Tables

Previous Thread :: Next Thread 
99Nickster is not online. 99Nickster
Joined: 27 Jan 2012
Total Posts: 289
09 Aug 2012 04:45 AM
I know you can use tables to add an item,


table.insert(TableName,Whattoinsert)


But, does anyone know if there is a way to remove something from a table?
Report Abuse
Brofessions is not online. Brofessions
Joined: 30 Jul 2012
Total Posts: 214
09 Aug 2012 04:47 AM
table.remove(table,positionintable)

like so

table = {"Cool","Dah","Test"}

table.remove(table,2)
print(table[2])
>Test
Report Abuse
99Nickster is not online. 99Nickster
Joined: 27 Jan 2012
Total Posts: 289
09 Aug 2012 04:52 AM
Workspace.Script.5:attempt to call field 'remove' (a nil value)

Should there be a function with it or something?
Report Abuse
Brofessions is not online. Brofessions
Joined: 30 Jul 2012
Total Posts: 214
09 Aug 2012 04:53 AM
Posting the script would be nice
Report Abuse
su8 is not online. su8
Joined: 06 Mar 2009
Total Posts: 6334
09 Aug 2012 04:56 AM
it was your script stupid, you overwrote 'table'
Report Abuse
99Nickster is not online. 99Nickster
Joined: 27 Jan 2012
Total Posts: 289
09 Aug 2012 04:57 AM
function FindTarget()

local Target = false

while wait(5) do
if game.Players.NumPlayers ~= 0 and
Target == false then
Target = true
for i,v in pairs(game.Players:getChildren()[math.random(1, game.Players)]) do
table.insert(Target,v)
if v.Character.Humanoid.Health == 0 then
Target = false
end
end
end
end

end

It's in beta so don't judge me :P
Report Abuse
WishNite is not online. WishNite
Joined: 11 Feb 2009
Total Posts: 15828
09 Aug 2012 04:58 AM
lol it's late give me a break
Report Abuse
Brofessions is not online. Brofessions
Joined: 30 Jul 2012
Total Posts: 214
09 Aug 2012 05:00 AM
So essentially su8 was right - you can't have name variables table apparently.

Try renaming the table to something else
Report Abuse
99Nickster is not online. 99Nickster
Joined: 27 Jan 2012
Total Posts: 289
09 Aug 2012 05:01 AM
Testing*
Report Abuse
99Nickster is not online. 99Nickster
Joined: 27 Jan 2012
Total Posts: 289
09 Aug 2012 05:02 AM
It worked! Thanks for all the help you guys! :D
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