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

[SOLVED] onEnter Morph/Character Editing?

Asked by
sgsharp 265 Moderation Voter
10 years ago

THIS QUESTION HAS BEEN SOLVED.

I've tried to do this multiple times, but I cannot get the hang of it... My plan is to have a player's character load as a custom character... Similar to those at Nikilis's "Murder Mystery" game.

I don't want to use .CharacterAppearance, I want the character's appearance to be similar to a morph, but it automatically applies to the character onEnter.

I've tried the code below... However, it did not work.

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        character.Shirt:remove()
        character.Pants:remove()
    end)
end)

I also tried this...

Game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(char)
char:WaitForChild("Shirt"):remove();
char:WaitForChild("Pants"):remove();
end)
end)

-- Basic Naked Morph

[The output tells me that the shirt and pants are not a valid member of "Model."]

I have also tried reading other quests, but the answers didn't help me. The last time I attempted to post this, it was flagged as a duplicate because it has already been asked before. But the answers didn't help, so I asked it again...

Please provide detailed answers & sources.

1 answer

Log in to vote
1
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
10 years ago

First of all, remove() is deprecated. Use Destroy() instead.

When CharacterAdded fires, there's a tiny delay before the Character can actually be modified, so add a wait() with no argument just after that line.

You will run into the problem of character that aren't wearing Shirts of Pants, as well as characters that might be wearing other clothing items such as Hats or Tshirts. The easiest way to completely nuke a Character's appearance is to set the CanLoadCharacterAppearance property of their Player to false.

Game.Players.PlayerAdded:connect(function(Player)
    Player.CanLoadCharacterAppearance = false
end)

From there, you can do whatever you want to the Players' appearances.

Ad

Answer this question