Whenever I try to team someone in the playeradded it doesn't team them, it is wierd cause it was working a week ago.

(Also if I try printing something it does work, it is simply just not teaming the player)

USM = "United States Army"
JMP = "Military Police"
VISITOR = "Visitors"

local Players = game:GetService("Players")
 
Players.PlayerAdded:Connect(function(player)
	if player:IsInGroup(4490133) then
	print("yee")
	player.TeamColor = BrickColor.new("Fossil")
	elseif player:IsInGroup(4490133) then
	player.TeamColor = game.Teams[USM].TeamColor
	else
	player.TeamColor = game.Teams[VISITOR].TeamColor
	end
end)
	
game.Players.PlayerRejoining:connect(function(player)
	if player:IsInGroup(4490133) then
	player.TeamColor = game.Teams[JMP].TeamColor
	elseif player:IsInGroup(4490133) then
	player.TeamColor = game.Teams[USM].TeamColor
	else
	player.TeamColor = game.Teams[VISITOR].TeamColor
	end
end)

4 comments

0

If you're doing this on the client, PlayerAdded does not fire for the client the LocalScript is running on. A LocalScript is typically the descendant of a Player instance, and the player needs to exist before its descendants (like the PlayerGui, and this is one of the places where LocalScripts run) can exist.

0

However PlayerAdded will fire on the client for clients who join afterwards.

0

This is being run in a server script, not local.

0