How do I make this backpack face the right way?

I am making a game like mining simulator but I am having trouble making the backpack face the right way.


The backpack faces infront of the player instead of behind.

I’ve tried using alignorientation and alignposition but it still makes it face infront of the character.

If I try adding this onto the CFrame it causes the backpack to move far from where it’s supposed to be

CFrame.new(CFchar.X + 0, CFchar.Y + 0, CFchar.Z - backpack.Offset.Value) * CFrame.Angles(0, math.rad(180), 0)

image_2023-06-28_014655979

Script:

	game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		wait()
		local backpack = folder.DefaultBackpack:Clone()
		local CFchar = char.UpperTorso.CFrame

		local weld = Instance.new("Weld")
		weld.Part0 = char.UpperTorso
		weld.Part1 = backpack.Part

		weld.C0 = CFchar
		weld.C1 = CFrame.new(CFchar.X + 0, CFchar.Y + 0, CFchar.Z - backpack.Offset.Value) 

		weld.Parent = backpack
		for i, v in pairs(backpack:GetDescendants()) do
			if v:IsA("BasePart") then
				v.Anchored = false
			end
		end
		backpack.Parent = char
	end)
end)
1 Like

To make the backpack face behind the player instead of in front, you can modify the code as follows:

Script

game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
wait()
local backpack = folder.DefaultBackpack:Clone()
local CFchar = char.UpperTorso.CFrame

	local weld = Instance.new("Weld")
	weld.Part0 = char.UpperTorso
	weld.Part1 = backpack.Part

	weld.C0 = CFchar
	weld.C1 = CFchar * CFrame.new(0, 0, -backpack.Offset.Value) * CFrame.Angles(0, math.rad(180), 0)

	weld.Parent = backpack
	for i, v in pairs(backpack:GetDescendants()) do
		if v:IsA("BasePart") then
			v.Anchored = false
		end
	end
	backpack.Parent = char
end)

end)

Im new here and i dont really know how to put the script there so it seems a bit buggy . But i hope i could help.

Can you just take your backpack tool and rotate the handle 180 degrees?
Either that or use the Pivot Editor to rotate the Y axis 180 degrees.

2 Likes

Maybe add an invisible HumanoidRootPart to your Backpack.

Then all you need to do is match the HumanoidRootPart CFrames when welding.

Backpack.HumanoidRootPart.CFrame = Character.HumanoidRootPart.CFrame