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: WHAT'S WRONG WITH TABLE.INSERT???

Previous Thread :: Next Thread 
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
21 Dec 2013 10:46 AM
So I was making a zombie script that uses region3 (idk why) and then whenever I try to use table.insert(something,something2), it says:"attempt to call field 'insert' (a nil value)"
What??
If i do blah[index]=blah2 there's no error, but the thing isn't inserted...
wut
Please look at the area where it says **


function can_see(table)
local t=table
local c={}
Spawn(function()
for _,character in pairs(t) do
for i=-1,1,.5 do--fires like \\|//
local r=Ray.new(head.CFrame.p,(((character.Head.CFrame.p-head.CFrame.p).unit*(Area))+Vector3.new(0,0,i)))
local hit,pos=game:GetService('Workspace'):FindPartOnRayWithIgnoreList(r,ignore,true)
if hit and pos then
if hit:IsDescendantOf(character) then
if not already(c,character) then--checks if i already put in table
**table.insert(c,character)
print('once')
end
--print('i c u')
else
print('i dun c u')
end

end--hit right descend?
end--hit and pos?
end
end)
print('i return u')
return c
end
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
21 Dec 2013 10:52 AM
blump bumb poump biamp bawmp
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
21 Dec 2013 10:53 AM
bum
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
21 Dec 2013 10:55 AM
brmp
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
21 Dec 2013 11:00 AM
blrblrblr awdsoadska dij -_- is someoene gonna help.
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
21 Dec 2013 11:02 AM
ok i will go die now
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
21 Dec 2013 11:12 AM
9a sudmoasd9a sud9as uda siuas idwapsdiuasidwipasduwiapsuia usipaw sipa
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
21 Dec 2013 11:15 AM
bump 90000000000000000000000000 wt'fmannorrespondwth):
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
21 Dec 2013 11:16 AM
momasdiasp mdeluuuuuu
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
21 Dec 2013 11:18 AM
aaaaaaaaaaaaaaaaaaaaaaaaaarshoollllllllllllllock
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
21 Dec 2013 11:26 AM
k u guys suck
Report Abuse
xWOWZABOYx is not online. xWOWZABOYx
Joined: 05 Aug 2010
Total Posts: 2689
21 Dec 2013 11:27 AM
Wait doesn't insert have a capital I

【◄[ϟ]〓☜✪ xWOWZABOYx; FCOM, SQN COM, Scientist, Veteran, Visionary ✪☞〓[ϟ]►】
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
21 Dec 2013 11:28 AM
nope
Report Abuse
DrWaffler is not online. DrWaffler
Joined: 16 Sep 2011
Total Posts: 4248
21 Dec 2013 11:30 AM
function can_see(table)
local t=table

That's why.

You can't use table as a variable like that. Use tab instead, that is most common from what I see.

function can_see(tab)
local t = tab
--stuff
table.insert(name of the table, what to insert)

This is just a suggestion I have, but I usually use lower to upper format for naming things like functions and variables if they're more than word word/phrase.

instead of can_see I would do canSee.

onTouch,
playerList,
rarityTable,
canSee

just as examples.

It is also how I use method names

findFirstChild,
getChildren,
getPlayers

to name some examples.

Consistency makes life easy! :D

--[Territory Conquest Developer, Valerian Studios Developer, Business Casual Narwhal Moai. ]]--
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
21 Dec 2013 11:32 AM
:DDDDDDDD THANK YOU SOO MUCH I'VE BEEN LOOKING 4'ever THANK YOU THANK YOU!!!
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