Unable to rename a model that used to be a user's character

When I try to rename a ragdoll that used to be a user’s character I get the error: The current thread cannot set 'Character's name' (lacking capability WritePlayer)

This happens even after the user has a new character.

I want to rename old characters that are ragdolled so it’s easier to tell them apart from the current character when debugging.

are you sure that it isn’t the player’s character anymore?
player.Character = nil
otherwise clone their character, nullify the old one, and rename the cloned

Would you mind checking out https://devforum.roblox.com/t/how-to-post-a-bug-report/24388/20 Could you provide a bit more information?

The bug is that a Roblox error occurs when a script tries to rename a player’s character, as in game.Players.Meta_Maxim.Character.Name = "anything".

I expect it to change the character’s name and not produce an error.

Repro.rbxl (52.5 KB)

I attached a place with a script in workspace that causes the error with:

local function handlePlayer(player: Player)
	local character = player.Character or player.CharacterAdded:Wait()
	
	-- error will also happen if the model is no longer the player's character, as done by these commented lines:
	--character.Parent = nil
	--player.Character = nil
	character.Name = "new name..."
end

game.Players.PlayerAdded:Connect(handlePlayer)
for _, player in game.Players:GetPlayers() do
	handlePlayer(player)
end