local Players=game:GetService("Players")
local team=game:WaitForChild("Teams")
Players.PlayerAdded:Connect(function(player)
	local num=math.random(0,6)
	if num=='1' or '2' or '3' then
		player.Team = team:FindFirstChild("sc1")
	elseif num=='4' or '5' or '6' then
		player.Team = team:FindFirstChild("sc2")
	end
	print('aaa')
	local char=game.Workspace:WaitForChild(player.Name)
	print('aaa')
	if player.Team.Name == "sc2" then
		print('aaa')
		char.Shirt.ShirtTemplate = "rbxassetid://3097432231"
		char.LeftLeg.brickcolor= BrickColor.new("Bright Red")
	end

end)

Prints the first 2 'aaa's, but when I check if the player is in the team, nothing happens, how can I properly check this?

2 comments

0

Strings are truthy in Lua, so `num == '1' or '2' or '3' will always evaluate to '2' since math.random returns an integer not a string representation of it, so the condition is satisfied

0

teams are not placed in game, teams are placed in the players