How to make a Good Teams and Bad Teams?

As the title said, “How can I make a Good Team and Bad Teams!” How is going to work is like, Wizard Team & Viking Team is Bad Teams and they can’t kill each other but they can kill Knight & Guardian a.k.a Good Teams.

My Sword Script:

local tool = script.Parent

local idleAnim = script:WaitForChild("Idle")
local idleAnimTrack
local swingAnim = script:WaitForChild("Swing")
local swingAnimTrack

local slashSound = script:WaitForChild("SlashSound")
local sheathSound = script:WaitForChild("SheathSound")
local hitSound = script:WaitForChild("HitSound")

local hitCharacters = {}
local debounce = false

tool.Equipped:Connect(function()
	
	local humanoid = script.Parent.Parent.Humanoid
	if not idleAnimTrack then idleAnimTrack = humanoid:LoadAnimation(idleAnim) end
	
	idleAnimTrack:Play()
	
	sheathSound:Play()
end)
tool.Unequipped:Connect(function()
	
	if idleAnimTrack then idleAnimTrack:Stop() end
	if swingAnimTrack then swingAnimTrack:Stop() end
	
	sheathSound:Play()
end)
tool.Activated:Connect(function()
	
	if debounce then return end
	debounce = true
		
	local humanoid = script.Parent.Parent.Humanoid
	if not swingAnimTrack then swingAnimTrack = humanoid:LoadAnimation(swingAnim) end
	
	swingAnimTrack:Play()
	
	wait(0.5)	
	slashSound:Play()
	
	wait(0.5)
	debounce = false
end)
tool.Blade.Touched:Connect(function(touch)
	
	if hitCharacters[touch.Parent] or not debounce then return end
	if touch.Parent:FindFirstChild("Humanoid") then
		
		if touch.Name == "Head" then
			touch.Parent.Humanoid:TakeDamage(80)
		else
			touch.Parent.Humanoid:TakeDamage(80)
		end
		hitSound:Play()
		hitCharacters[touch.Parent] = true
		wait(1)
		hitCharacters[touch.Parent] = nil
	end
end)

Inspired from prtty much evry bordr gam evr

You make the teams.

Then in your weapons you do a team kill check, you can use an if statement to check the logic or a dictionary. From the Team | Roblox Creator Documentation documentation:

function checkTeamKill(playerAttack, playerVictim)
	if playerAttack.Team ~= playerVictim.Team or playerAttack.Neutral or playerVictim.Neutral then
		return false 
	end
	return true
end

Remember to search this up before posting it.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

Ahh okay! Let me go research a bit xD!