How to make a character-switching system(not change appreance only)

I want to ask how to make a character-switching system. I am currently making a fighting game and I want to change the script running on the player when the character is switched, I have tried to find some tutorials on YT but all are just teaching how to change the appearance but things that I want is to change the script because the different character has a different system.

Thank you

Put the characters model in replicated storage where they would all have their own scripts inside of them. Then whenever you switch character change the players character to the specific character in replicated storage.

But how can I put the character into the replicated storage? Each character has a different appearance and I don’t want to change the appearance.

Yes so make sure the appearance is a model that contains the scripts for the character inside. Then simply put the model into replicated storage.

you mean I need to make a script inside the character, and when I get the character from replicated storage, the character can auto change to the player appearance?

Yes I believe so, as long as it is done correctly.

ok, thank you, let me have a try.

No worries, let me know if you have any issues.

1 Like
local Players = game:GetService("Players")

local SetCharacterRemoteEvent = game.ReplicatedStorage.CharacterSkillEvent.SetCharacterRemoteEvent

SetCharacterRemoteEvent.OnServerEvent:Connect(function(plr, char)
	local Character = plr.Character or plr.CharacterAdded:Wait()
	local Humanoid = Character.Humanoid	
	
	local oldCharacter = plr.Character
	local newCharacter = char:Clone()
	
	local description = Players:GetHumanoidDescriptionFromUserId(plr.UserId)
	newCharacter.Humanoid:ApplyDescription(description)

	plr.Character = newCharacter
	newCharacter.Parent = game.Workspace	
	newCharacter:SetPrimaryPartCFrame(oldCharacter:GetPivot())
	oldCharacter:Destroy()
end)

This is my script, I fired it from the client side and received it on the server, but why did this error code happen?
Humanoid::ApplyDescription() DataModel was not available - Server - SetCharacterServerScript:14

I’m not the best scripter myself, so I not sure about that error. What I would recommend that you script is that there is an event inside replicated storage calle changeCharacter and then another script inside somewhere else (depends on where you want to call the change from). This script would fire the event and would be scripted so that the character would replace the current character.

1 Like

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