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

How do i manage to get the player's original clothes back on?

Asked by 5 years ago
Edited 5 years ago

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??

0
it's called resetting the character DeceptiveCaster 3761 — 5y
0
But if i reset the character, won't the character die or are you implying something else? mia290498 12 — 5y
0
if you reset the character, if I'm not mistaken, the character loads back in with the original avatar layout DeceptiveCaster 3761 — 5y
0
Player:LoadCharacter() would force a refresh Ziffixture 6913 — 5y
View all comments (5 more)
0
that's also resetting the character DeceptiveCaster 3761 — 5y
0
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. User#25115 0 — 5y
0
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()" User#25115 0 — 5y
0
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. User#25115 0 — 5y
0
@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.. mia290498 12 — 5y

2 answers

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

Well, I'd say that if you put the original clothes of a character in another service (say ServerStorage) and then create code that will put those clothes back on, that would work. In a more simple matter, you would write code to store the original clothes in ServerStorage, then when you want the character to get their normal clothes back, you could write code to get the clothes from ServerStorage.

0
No. DeceptiveCaster 3761 — 5y
0
ServerStorage is not a "folder." It's a service. User#25115 0 — 5y
0
I put it into a model and it worked..Thanks you guided me pretty close to the solution mia290498 12 — 5y
0
It worked. That's what matters. ChasingNachos 133 — 5y
0
I put it into a model in starterPlayer mia290498 12 — 5y
Ad
Log in to vote
1
Answered by 5 years ago

OMG it worked!!! I put it to wait for like 5 sec and stored the shirt content into a model And then used that as reference Thanks All..

Answer this question