Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Having trouble with tables in admin commands?

This wont work

Admins = {"Name"}


table.insert(Admins, player) 

--[[
I Have player set to player.Name:lower()
So I can do commands such as !kill blox
]]

This doesn't work, and I'm not sure if I need to add some kind of function or whatever..

Please help :)

5 comments

0

And whos the kid who gave -1 because he / she doesnt know lua?

2

I down voted your question because you provided no context, no insight on what you actually want your code to do, and nothing describing what it's doing that you don't want it to do. You're question is basically a set-up for someone to make the code for you, without mutual understanding on how it works at all.

0

In fact, I'm also voting moderation on your question for being way too broad.

0

Ouch.

0

OH shhfhh jeez. We need to take a moment to appreciate Script's eloquent yet cold reason as to why they downvoted.

1 answer

You need to specify a position before the value, so it's like

local pos = math.random(1,10) -- any position
local value = "any value
"
table.insert(table, pos, value)

table.insert shifts the rest upwards, rather than overriding, so just placing it at position 1 should be sufficient.

Here's the fixed version of your little issue:

Admins = {"Name"}

table.insert(Admins, 1, player) 

1 comment

0

Not including a position will append the value, so not only are you not answering the question you are providing misinformation.

This discussion is preserved as it was. New answers, comments, and votes are closed.