I am trying to make a game about the anime "Shingeki no Kyojin". I have some character models for some of the characters and I am trying to make a dev panel where you can switch from 1 character to another. The problem is since i need the character's name to match the players name for other scripts i need to make, if you switch from one character to another, you cant switch back to the one you first selected. I dont even know how to fix this.
Srry if the script is bad i've been scripting for about 1 year 4 months now.
local CharacterEvents = game.ReplicatedStorage.CharacterEvents
local Characters = game.ReplicatedStorage.Characters
local ErenModel = Characters.Eren:Clone()
local ArminModel = Characters.Armin:Clone()
CharacterEvents.Eren.OnServerEvent:Connect(function(player)
local PlayerPos = workspace:WaitForChild(player.Name):GetPrimaryPartCFrame()
ErenModel.Name = player.Name
player.Character = ErenModel
ErenModel.Parent = workspace
ErenModel:SetPrimaryPartCFrame(PlayerPos)
end)
CharacterEvents.Armin.OnServerEvent:Connect(function(player)
local PlayerPos = workspace:WaitForChild(player.Name):GetPrimaryPartCFrame()
ArminModel.Name = player.Name
player.Character = ArminModel
ArminModel.Parent = workspace
ArminModel:SetPrimaryPartCFrame(PlayerPos)
end)

3 comments
You are attempting to make the player with your character which is not correct, you should like parent all pieces of erenmodel to character of player.
dont forget to remove the old pieces of the player character
???