I have some teams in my game. If the player is in the 'Police' team, it should give the player some default tools.
What did I try?
Well, I tried this in a normal script inside ServerScriptService:
game.Players.PlayerAdded:Connect(function(Player)
print(Player.TeamColor)
if Player.TeamColor == "Really blue" then
for i, tool in pairs(game.ReplicatedStorage.Tools:GetChildren()) do
tool:Clone().Parent = Player.Backpack
tool:Clone().Parent = Player.StarterGear
end
else
print("Player is not in police team.")
end
end)
The colour 'Really blue' is for the Police Team. As you can see, I even tried to print the player's team colour. The output showed 'Really blue'. Which means the player is in the blue team. But when, inside the if statement, it does not recognize the team color. What I mean by saying is, that the else statement get's run instead of the if statement. If the team colour is 'Really blue', then it basically means that the player is in the police team. But then why is the else part running despite the output showing that the player is in the blue team. (NOTE: I have spelled everything correctly and the name of the teams is correctly written).
I even tried the above script in a characterAdded event but with no success.
Anyone have any idea what is causing the issues?
Thanks for any help

1 comment
maybe it is cloning when the character/tool is not fully loaded