I’m currently working on a Sword Duel game and I came across that I forgot to add a Anti Team Kill using teams, though, I’m completely suck on how to do so. The area is about 4 players on each team and. 4 pads the left and 4 on the right and the players get teleported to the left and right based on the side they stood on.
Would there be any way I could add a Team System to this specific code and assign each player their own team?
for i, Data in pairs(PlayersInRound) do
local Player = Data.Player
local Team = Data.Team
local StartPad = Team.Spawn
wait(0.1)
Player:LoadCharacter()
local Character = Player.Character
if Character.Parent and Character.Humanoid.Health > 0 then
Data.Alive = true
TeamMembersSpawned[Team] = (TeamMembersSpawned[Team] and TeamMembersSpawned[Team] + 1) or 1
Character.PrimaryPart.CFrame = StartPad.CFrame + Vector3.new(0,(StartPad.Size.Y/2)+3,0) + (StartPad.CFrame.RightVector * ((-2 * (TeamSizes[Team] - 1)) + (4 * (TeamMembersSpawned[Team] - 1))))
ServerStorage.ClassicSword:Clone().Parent = Player.Backpack
local function CheckRoundEnd()
Data.Alive = false
CheckEvent:Fire()
end