Unable to cast instance to token (ReplaceBodyPartR15)

Hi there.

I’m getting this error, and I’m not sure how to fix it:

Unable to cast Instance to token.

The following is my script. I’m trying to replace my character hands with a blade.

local Players = game:GetService("Players")

		
local LH = game.Workspace.LeftHand
local LA = game.Workspace.LeftLowerArm
local RH = game.Workspace.RightHand
local RA = game.Workspace.RightLowerArm


game.Players.PlayerAdded:Connect(function(Plr)
	Plr.CharacterAdded:Connect(function(C)
		local Player = Players:GetPlayerFromCharacter(C)
		local LeftHand = C:FindFirstChild("LeftHand")
		local Humanoid = Player.Character.Humanoid
		Humanoid:ReplaceBodyPartR15(LeftHand,LH)
	end)
end)

I’ve actually been struggling with replacing humanoid parts for awhile now, so any help would be greatly appreciated :slight_smile:

1 Like

The first parameter for ReplaceBodyPartR15 is a BodyPartR15 value.

Humanoid:ReplaceBodyPartR15(Enum.BodyPartR15.LeftHand, LH)

You can also use

Humanoid:GetBodyPartR15(PART) 

This will return the Enum.BodyPartR15 value of a specific part.