So I'm making a new game where if you turn into a certain team, then you have a certain avatar. But I can't find how to script it. Anyone got any ideas?
I have done this many time, and it is not that difficult once you learn how, also turn off LoadCharacterAppearance in StarterPlayer so you don't have to add extra code to delete the pre-defined clothing.
First off, you need to create a player added function.
game.Players.PlayerAdded:Connect(function(plr) wait(1) local character = plr.Character --Gets the character of the player end)
Now, you have to check for the team.
game.Players.PlayerAdded:Connect(function(plr) wait(1) local character = plr.Character --Gets the character of the player if plr.TeamColor == color then --Insert team color here --Clone items here and put them into the player end end)
An example of cloning an item
game.Players.PlayerAdded:Connect(function(plr) wait(1) local character = plr.Character --Gets the character of the player if plr.TeamColor == color then --Insert team color here local shirt = game.ReplicatedStorage.Shirt shirt:Clone() shirt.Parent = character --You can also delete this line and use shirt:Clone(plr) end end)
You're (hopefully) all set!