Unable to cast string to token

Ayo guys, so I have a script and it prints out this a couple of times “Unable to cast string to token”
I want to know what is it? Will it break anything?

Here’s the script!

-- Load Skinned Mesh Rig

--get information
local players = game:GetService("Players")
local rig = game.ServerStorage["SkinnedMeshCharacter"]

--stuffs
local function Update(character) --create a function
	local humanoid = character:FindFirstChildOfClass("Humanoid") --detect Humanoid (if the model doesn't have humanoid it won't detect everything, only for players cuz they have humanoid)
	if not humanoid or humanoid.Health <= 0 then return end
	humanoid:UnequipTools() 
	for _, part in pairs(rig:GetDescendants()) do
		if part:IsA("BasePart") then --if this part is a basepart then
			humanoid:ReplaceBodyPartR15(part.Name, part:Clone())--replace every parts in the character to the mesh part (which is deformed)
		end
	end
end

local function PlayerJoined(player) --get function about when a player join
	player.CharacterAppearanceLoaded:Connect(Update) --every times a player join, it will update
end


players.PlayerAdded:Connect(PlayerJoined)--same

I haven’t done any solutions cuz I don’t know what it is.

Thanks!

Which line is the error coming from?

The only thing that I think would cause problem in this code. is the part.Name on this function, are you sure you named the parts correctly?

1 Like

line 14

humanoid:ReplaceBodyPartR15(part.Name, part:Clone())

Oh thanks! I just realized that i named LeftLowerLeg twice!