Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can someone help me with the table for Admin Commands?

Asked by 6 years ago

`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)
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. cabbler 1942 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago

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)
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 AwesomeBuilder346 11 — 6y
0
Of course you can. TheHospitalDev 1134 — 6y
Ad

Answer this question