I'm trying to create a script that automatically changes the player's appearance on spawn.
This is my code so far for changing the shirt:
wait(5)
local playerModel = game.Players.LocalPlayer.Character
local shirt = playerModel:FindFirstChild("Shirt")
if shirt then shirt:Destroy() end
local newshirt = Instance.new("Shirt")
newshirt.Name = "Shirt"
newshirt.ShirtTemplate = "http://www.roblox.com/asset/?id=144076358"
newshirt.Parent = playerModel
Except that this doesn't work. The old shirt is deleted and the new shirt is placed successfully in the player model, but the new shirt doesn't show up. The player just has no shirt.
I have also tried the alternative
wait(5)
local player = game.Players.LocalPlayer
local playerModel = player.Character
player:ClearCharacterAppearance()
local newshirt = Instance.new("Shirt")
newshirt.Name = "Shirt"
newshirt.ShirtTemplate = "http://www.roblox.com/asset/?id=144076358"
newshirt.Parent = playerModel
This just leaves the player naked. The new shirt is still correctly placed in the model though!
I've spent hours trying different methods and researching this problem, like cloning the new shirt into the player model, but nothing has worked. I even found threads with this problem on this site, but those were old and also didn't work.
BTW, the wait() is just a placeholder for the code that waits until the player is fully loaded. I also own the shirt, so owning the shirt doesn't seem to be the problem.
Free model morphs do work, and their code seems to be almost the exact same, but for some reason mine doesn't work.

1 comment
Don't use a wait() at the top of the script. It's bad practice. Use WaitForChild to load other objects and the CharacterAdded event to wait for the character. And I think the shirt must be yours.