How to make the player change characters

hello i am making a stand in my game and its based on omori for those who know something about the game its that when omori takes a fatal hit he always survives on 1 hp with the text “Omori did not succumb” appearing i want to make the same thing apply for the stand and its user by making it so when the user takes a fatal hit he dies but the stand does not succumb and then you switch and start controlling the stand without its user being present

image

also it doesnt matter if the user humanoid gets deletted when switching to the stand since he is supposed to die anyway thats the whole idea

the problem is i have no idea on where to begain or what to use in order to do it i’ve read a couple posts but they are usally reporting a problem so the codes and answers i find there are like super specifc if someone can provide me with a doccument or a really simple version of the code that i can modify and upgrade to learn on i’d be really thankful .

11 Likes

If you want to have a custom character as a starting one.
Put your Rig model inside StarterPlayer and rename the model to “StarterPlayerCharacter”

If you want to change character during runtime, you can do that by changing player property.
Player.Character = yourRig
Don’t forget to update cameraSubject on currentCamera

7 Likes

it kind of worked i cant move the player though

2 Likes

You could just clear your character clothes etc, and copy from the custom character

1 Like

i dont want to copy the cloth due to the rig having alot of specific stuff and code so cloning everything will be really messy cant we just make the rig be able to move
when using “player.character = rig” everything works fine exept that i cant control or move the rig

1 Like

Make sure the new rig is also named StarterCharacter or it wont work

1 Like

it is working? i will send a video of what is happening in studio rn to explain what i want to do

1 Like

the current dummies are test dummies and when i switch to the test dummy i cant move or jump i just want to know if there is a way to be able to move

2 Likes

Im pretty sure you can only move if it is named StarterCharacter

2 Likes

Make sure the PrimaryPart is the HumanoidRootPart and that the HumanoidRootPart isn’t anchored

3 Likes

Instead of changing characters you can spawn a clone dummy of yourself and change your actual character appearance to look exactly like the swap character.

I would like to know if there’s a better way to do this as well

1 Like

unachor the humanoidrootpart…

30charrrrr

2 Likes

both the primaryPart and the humanoidRootPart unachored

1 Like

You should also make sure the whole model is unanchored or it will likely cause issues

1 Like

so frist naming it StarterCharacter didnt work

1 Like

second i need to be able to control the rig itself like how jujutsu shenanigens does with the ten shadows and mahoraga mahoraga isnt simply a reskin of the player he is a whole model

1 Like

third yes all of the model is unanchored the problem isnt that the model is immoveable the problem is that the model isnt capable of moving

1 Like

Okay, here are my final suggestions to you.

Name it startercharacter and make sure you’re parenting it into the startercharacter otherwise it wont work.

As you already said make sure everything is unanchored and the models primary part is the humanoid root part.

Another thing could be the name of the parts inside your model (Example: UpperRightLeg, and the joints should be like Right Shoulder, make sure theres a space)

Anyways, good luck!

1 Like

so i managed to do it and here is the script and stuff i found out

in the local script

UserInputService.InputBegan:Connect(function(input, Typing)
	if Typing == true then return end
	if input.KeyCode == Enum.KeyCode.E then
		workspace.Camera.CameraSubject = workspace.CustomRig.Humanoid   -- switching camera target
		storage.RemoteEvent:FireServer()
	end
end)

in the server script

storage.RemoteEvent.OnServerEvent:Connect(function(plr)
        -- cloning the scripts from the old character befor it gets deletted
	local anim = plr.Character.Animate:Clone()
	local hp = plr.Character.Health:Clone()
        -- switching the character which will delete the old one
	plr.Character = workspace.CustomRig 
	plr.Character.HumanoidRootPart.Anchored = false
        -- parenting the copied scripts to the new rig
	hp.Parent = plr.Character
	anim.Parent = plr.Character
end)

what i found out
1: the rig doesnt need to be named StarterCharacter
2: you need to switch the player’s character in the server side otherwise it might cause some weird bugs
3: when switching from the server side the old character gets deletted so make sure to copy both the health and animate script befor switching and after the switch paste them into the new character

here is the final result

6 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.