Im working on a transform button and I'd like when the player clicks on the button the second time it transforms it back into his original clothes..
the first transformation is working fine but the second transformation is not However, if i insert a print statement, its working absolutely fine. So i guess, its the values assigned as its telling me Attempt to index a nil value
local character=game.Players.LocalPlayer.Character
local ogshirt = character:FindFirstChildOfClass("Shirt").ShirtTemplate
local ogpants = character:FindFirstChildOfClass("Pants").PantsTemplate
character.Shirt.ShirtTemplate=ogshirt
character.Pants.PantsTemplate=ogpants
Maybe I should attempt to use the GetCharacterAppearanceInfoAsync??

9 comments
it's called resetting the character
But if i reset the character, won't the character die or are you implying something else?
if you reset the character, if I'm not mistaken, the character loads back in with the original avatar layout
Player:LoadCharacter() would force a refresh
that's also resetting the character
If you don't want a reset, you're going to have to save their clothing upon their joining and give the clothing back to them whenever you wish. It looks like you're on the right track with this.
I think your script is loading in before the character, so character doesn't exist. You could use "local character = player.Character or player.CharacterAdded:Wait()"
I do believe that you need to do this from the server, though. I don't think Roblox would allow players to change their appearance.
@Phlegethon5778 thanks!! i did the waiting stuff and saving upon joining and it seemed to worked..So i guess im gonna go tidy my codes now..Thanks again..