Need help for a function

This function is triggered when the player enters the game, for a reason that escapes me I have this error message:
image

local function SetupInventory(player)

if player:WaitForChild("Inventory").Shamisen.Value == true then
	
	local ShamisenClone = RS.Shamisen:Clone()
ShamisenClone.Parent = player.Backpack

local Attach = Instance.new("Motor6D")
Attach.Name = ("Shamisen")
Attach.Parent = player.Character.LowerTorso
Attach.Part0 = player.Character.LowerTorso
Attach.Part1 = player.Backpack.Shamisen.Shamisen

	player:WaitForChild("PlayerGui").Interface.ShamisenF.Visible = true
end

end

I hope you can help me, thank you

LowerTorso is for the R15 rig only. R6 uses Torso, so you’d either have to support both with their respective body parts or make the game R15 if you want to only support LowerTorso.

Hi, thanks for response, Im testing the function with a R15. I noticed something strange, sometimes the function works but sometimes it does this error message I really do not understand

Can you show us exactly what line pls?

Just thought, the character might’ve not loaded when you’re trying to get the LowerTorso:

local character = player.Character or player.CharacterAdded:Wait()

This gets the player’s character or yields until the character is added.

2 Likes

Thank you for taking the time to help me!