Here's my Script.

workspace.ChildAdded:Connect(function(Child)
	print("Child Added to Workspace!")
	local h = Child:FindFirstChild("Humanoid")
	if h then
		print("Humanoid exists!")
		local Player = game.Players:FindFirstChild(Child.Name)
		if Player then
			print("Player Exists!")
			if Player.Team == game.Teams.Criminals and Player.TeamColor == game.Teams.Cops.TeamColor then
				Child.Parent = workspace.InGame.Cops
				Child:MoveTo(workspace.PoliceHQ.PoliceTeleports["Part"..math.random(1,15).Position])
				game.ReplicatedStorage.Handcuffs:Clone().Parent = Player.Backpack
				game.ReplicatedStorage.Keycard:Clone().Parent = Player.Backpack
				game.ReplicatedStorage.Guns.Rifle:Clone().Parent = Player.Backpack
				game.ReplicatedStorage.Guns.Pistol:Clone().Parent = Player.Backpack
				print("Player sorted into Cop Team!")
			elseif Player.Team == game.Teams.Cops and Player.TeamColor == game.Teams.Cops.TeamColor then
				Child.Parent = workspace.InGame.Criminals
				Child:MoveTo(workspace.CrimHQ.CrimTeleports["Part"..math.random(1,15).Position])
				print("Player sorted into Criminal Team!")
			else
				print("Player sorted into Lobby Team!")
			end
		end
	end
end)

Every time, even when I'm in a different team, the Output says "Player sorted into Lobby Team!" Please help me! Game: roblox.com/games/5506617257/Cops-and-Robbers

1 comment

0

Try removing Player.Team = game.Teams.Cops and Player.Team = game.Teams.Criminals