Character Switch not working

Im really new to scripting- erm, why doesnt this work? What it should do is when Z is pressed your character is changed to a different one.

1 Like

It is because you have put an event instead of calling function directly or simply drop the function.

Currently what will happen with that is, you press Z and PlayerAdded event will be hooked, when a player joins their humanoid will be changed, player who clicked Z will not have their humanoid changed or players joined before that player, and since this must be a local script, no one can see the change except the player pressing Z

PS: this is placed in wrong category

InputService only works under local scripts, not server scripts.
The character appearance only applies whenever another player joins.
This script connects the playeradded event everytime the player hits the Z key, this can cause a memory leak!
Also, why are you checking if the input is from a keyboard??? Usually there’s no way that the Z key can come from a mouse or a controller.

How would I get a function to work with this, where would I put it?

Read this.

I did- but what do I do with it?

There is the solution for this problem in that article.

  • A Humanoid instance named StarterHumanoid , which will be used as the default humanoid for each player’s character.
  • A Model instance named StarterCharacter , which will be used as the character model for all players

So I have this- I thought it’d work but unfortunately it didnt.

you havent load the humanoid description
player:LoadCharacterWithHumanoidDescription(humanoidDescription)
is that the whole script i cant find player

or just dress a character change the name of the model as StarterCharacter and place it inside StarterPlayer in studio

As @Aanggoodluck said you need to load HumanoidDescription

To get the player simply use
game.Players.LocalPlayer
and load HumanoidDescription on that.

?