I cant set the name of character model

I am currently working on a character switch script it works fine up until I have to change the name, it says I lack the compabilities to change its name, I tried different ways of changing the name same error, why is this? what me

this is the code I have

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage:WaitForChild("SwitchCharacters")

RemoteEvent.OnServerEvent:Connect(function(Player,Mod)
    local CharMod = require(Mod)
	local CharModel = CharMod.CharModel:Clone()
	local PlrCharacter = Player.Character
	
	if PlrCharacter then
		CharModel.HumanoidRootPart.Anchored = false
		CharModel:SetPrimaryPartCFrame(PlrCharacter.PrimaryPart.CFrame)
		Player.Character = CharModel
		CharModel.Parent = workspace
		CharModel.Name = Player.Name -- Doesn't Work
	end

end)

Change the name before trying to parent to the workspace.

Nevermind Guys, I had to change the Name before setting the players character equal to the new character model

1 Like

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