I'm not sure where to start, I want to assign a group of players to multiple teams all at once. I want to be able to mention multiple names at once like
:team Builderman,Person299,Bowanw,Shedletsky Red
or even assign half the players from one team to another (example, neutral to Blue)
:team %random% Blue
I'm only used to doing one argument commands, so any help is appreciated...
This is my admin command script so far, to get you an idea on how I've set things up.
-- Admins
Admins = {"bowanw","Player1"} -- Admin List.
Prefix = ":" -- This allows you to change the prefix of each command.
function checkAdmin(player) -- This function checks that the player using the commands, is an Admin
for i=1,table.getn(Admins) do
if player.Name:lower() == Admins[i]:lower() then
return true
end
end
end
--[[
Current List of Commands:
:open Opens Training Room Outside Door
:close Closes Training Room Outside Door
:load <Item> Loads item into the game
:unload <Item> Unloads item from the game
--]]
game.Players.PlayerAdded:connect(function(player) -- This runs a function as soon as the player joins
if checkAdmin(player) then -- Checks that the player is an Admin
player.Chatted:connect(function(msg)
--These functions are what run the commands.
function CloseDoor(bool)
if bool then
workspace["Training Assembly Room"].Door.Transparency = 0
workspace["Training Assembly Room"].Door.CanCollide = true
else
workspace["Training Assembly Room"].Door.Transparency = 1
workspace["Training Assembly Room"].Door.CanCollide = false
end
end
function Load(Str)
if game.ServerStorage:FindFirstChild(Str) then
local part = game.ServerStorage:FindFirstChild(Str):Clone()
part.Parent = workspace
end
end
function UnLoad(Str)
if game.ServerStorage:FindFirstChild(Str) and workspace:FindFirstChild(Str) then -- Its neccesary to still check the server storage, otherwise we may delete other parts we do not want to.
workspace:FindFirstChild(Str):Destroy()
end
end
-- These are the if statements that trigger the functions that run the commands.
if msg:sub(1,5):lower() == Prefix.."open" then
CloseDoor(false)
end
if msg:sub(1,6):lower() == Prefix.."close" then
CloseDoor(true)
end
if msg:sub(1,5):lower() == Prefix.."load" then
Load(msg:sub(7))
end
if msg:sub(1,7):lower() == Prefix.."unload" then
UnLoad(msg:sub(9))
end
end)
end
end)

4 comments
There's a property in each player called "TeamColor" which behaves similar to BrickColor in parts. With the putting multiple people in the command, you can take a look at strings and how they work for that.
Watch the language! You can read our community guidelines here: https://scriptinghelpers.org/help/community-guidelines/
@M39a9am3r, I'm sorry mate... but what language have I used that is deemed inappropriate?
@Tempestatem, I understand how to assign a player to a team, my question is how I would set this up for a command. To use more than one argument...