So I have 2 scripts and I am trying to use a big global table. For some odd reason it won't work. Console says theres an error on line 12 however the script editor underlines the [] Heres the global table:
_G.Admins =
{
["conman0552"]
}
For some reason it also doesn't like my [] either
My script I want to use it with:
local isAdmin = _G.Admins
function findPlayer(name)
for _, player in ipairs(game.Players:GetPlayers()) do
if player.Name:lower() == name:lower() then
return player
end
end
end
function onChatted(message, player)
if message == "Close" and isAdmin[player.Name] then --change ":normal" to the name of the command
game.Lighting.Door.Parent = game.Workspace
end
--copy everything from 'if message == ":norma;"' until the first 'end' and paste it between this and the 'end' below this.
end
--Copy and paste everything from if message == until the first 'end' and change the building name and command each time.
game.Players.PlayerAdded:connect(function(player)
player.Chatted:connect(function(message) onChatted(message, player) end)
end)
and
local isAdmin = _G.Admins
function findPlayer(name)
for _, player in ipairs(game.Players:GetPlayers()) do
if player.Name:lower() == name:lower() then
return player
end
end
end
function onChatted(message, player)
if message == "Open" and isAdmin[player.Name] then --change ":normal" to the name of the command
game.Workspace.Door.Parent = game.Lighting
end
--copy everything from 'if message == ":norma;"' until the first 'end' and paste it between this and the 'end' below this.
end
--Copy and paste everything from if message == until the first 'end' and change the building name and command each time.
game.Players.PlayerAdded:connect(function(player)
player.Chatted:connect(function(message) onChatted(message, player) end)
end)
On both the door scripts the error is on line 12

2 comments
Edited, see this in the morning
I urge you check for the player's ID instead of their name, since players can change their name.