Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do you make a custom avatar for teams?

Asked by 5 years ago

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?

0
Does the certain avatar have accessories? User#25069 0 — 5y
0
Yes CappaFish1 3 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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.

1game.Players.PlayerAdded:Connect(function(plr)
2    wait(1)
3    local character = plr.Character --Gets the character of the player
4end)

Now, you have to check for the team.

1game.Players.PlayerAdded:Connect(function(plr)
2    wait(1)
3    local character = plr.Character --Gets the character of the player
4 
5    if plr.TeamColor == color then --Insert team color here
6        --Clone items here and put them into the player
7    end
8end)

An example of cloning an item

01game.Players.PlayerAdded:Connect(function(plr)
02    wait(1)
03    local character = plr.Character --Gets the character of the player
04 
05    if plr.TeamColor == color then --Insert team color here
06        local shirt = game.ReplicatedStorage.Shirt
07        shirt:Clone()
08        shirt.Parent = character --You can also delete this line and use shirt:Clone(plr)
09    end
10end)

You're (hopefully) all set!

Ad

Answer this question