The code below checks if a players UserId is the same as the one in the table and if they type !Admin in the chat its meant to make a UI visible or invisible depending on its state.
This works in studio but doesn't in a regular server? How would I make it work in a regular server?
--- Turning Admin UI on and Off
local admins = {
21063444;
}
local function IsAdmin(Player)
for _,Admin in pairs(admins) do
if type(Admin) == "number" and Admin == Player.UserId then
return true
end
end
end
game.Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(message, recipient)
if not recipient and IsAdmin(Player) then
if message == "!Admin" then
if Player.PlayerGui.Console.Main.Visible == true then
Player.PlayerGui.Console.Main.Visible = false
elseif Player.PlayerGui.Console.Main.Visible == false then
Player.PlayerGui.Console.Main.Visible = true
end
end
end
end)
end)

2 comments
I assume the script is located in workspace?
The script is located in serverscriptservice