Hello all!
I am creating a script(well hoping too), that gets each team (don't know if player added is a good idea or not, this entire script is my attempt, so I am looking for feedback how to either fix this; properly do it; or simply a way to do it if my method is horribly wrong)
The thing I am looking to accomplish is when the players are teleported into the game; it will choose one from each team to be the "Commander". Easier said then done.
My script gives no errors; therefor I am not certain as to what the problem is. My code is below, thank you for all's help!
local Teams = game:GetService("Teams"):GetTeams()
game.Players.PlayerAdded:Connect(function()
for _, Mercs in ipairs(Teams) do
if Mercs == Teams.Name == "Mercs" then
local players = Mercs:GetPlayers()
local Commander = math.random(1,#players)
local CommanderIndicate = Instance.new("BoolValue")
CommanderIndicate.Name = "Commander"
CommanderIndicate.Parent = Commander
local ComsPoints = Instance.new("NumberValue")
ComsPoints.Name = "Points"
ComsPoints.Parent = CommanderIndicate
end
end
end)
game.Players.PlayerAdded:Connect(function()
for _, SEALs in ipairs(Teams) do
if SEALs == Teams.Name == "SEALs" then
local players = SEALs:GetPlayers()
local Commander = math.random(1,#players)
local CommanderIndicate = Instance.new("BoolValue")
CommanderIndicate.Name = "Commander"
CommanderIndicate.Parent = Commander
local ComsPoints = Instance.new("NumberValue")
ComsPoints.Name = "Points"
ComsPoints.Parent = CommanderIndicate
end
end
end)

1 comment
No, this didn't. Thank you for the attempt though.