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

Can someone help me with the table for Admin Commands?

`I am trying to make a admin script and I can't figure out how to make admin tables. I found from a video but it must not be working. Nothing is appearing in the output. I will put both code in here. So examine it and please determine if its correct. Thank you!~~~~~~~~~~~~~~~~~

local dank = {"AwesomeBuilder346"}
for i,v in pairs(dank) do
	game.Players[dank[i]].Chatted:connect(function(msg)

1 comment

0

You need to use UserId since ppl can change names. Also don't loop through the table. OnPlayerAdded check if the player is in the table.

1 answer

✓ Accepted answer

There is a much easier way of doing this without the loop for checking the player name.

local dank = {"AwesomeBuilder346"} --Your table of Admins

game.Players.PlayerAdded:Connect(function(player) --When a player joins, get the player's object
	if dank[player] then --If the table contains the player, then proceed
		player.Chatted:Connect(function(msg) --And then just do your functions from here.
			print(msg)	
		end)
	end
end)

2 comments

0

If I want to test this, can I do it in Studio because my commands won't work and I need to know if its the command or the script or studio

0

Of course you can.

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