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. the reason im changing the player's character is because i want it similar to a morph.
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)

5 comments
maybe try to put local ErenModel = and ArminModel = into the function
or try to set the old model to a different parent or destroy it
The programs you write in Studio are executed at a Thread Identity of two. The identity capable of modifying the name of a Character is four, a permission granted to Core-scripts.
Renaming the Character will cause a number of internal security conflicts, therefore it is denied and declared as a read-only property.
In short, you'll have to create your own custom name-tag GUI.