Now we will begin coding the OutfitPart Script. We will begin coding on Line 1-4 with setting up some local variables.
Create two variables that connect the Parent of the Script (OutfitPart) to the OutfitChanger Model.
Now we will create two more variables that gets the Shirt and Pants Template from your OutfitChanger Model.
Now we need to create a Touched Event that will connect to a Function on Line 6 that checks if the object touching the OutfitPart is a player.
After we have defined our function, it’s time to write what the function does. We are going to add an if then statement on Line 7 to define what the function does if a player touches the OutfitPart.
Change the Player Shirt and Pants ID
Now we will change the player’s Shirt and Pants by using the ID that you will change later. This is represented on Lines 8-10.