How would I make a back mounted tool?

I have a mechanic in my game where players look for scraps of material etc. to return to a bunker in order to get a good ending.
I’m trying to make a script which mounts a tool/model to a player’s back.

Even better, I was going to try to have it rotate to a 45° angle so that it looks more natural.

The tool CAN’T be a backpack item, I need the model to weld to the back but have no place in their backpack, it should be purely cosmetic.

How would I go about this? Do I need to play aroud with Motor6Ds or Welds? Or is it attachments or something I need to be looking into?

Any help would be appreciated as I have no idea where to start with this, thanks!

1 Like

I’m pretty sure you already know about this but if you don’t use the tool.Equipped and tool.Unequipped event and when you unequip it, you just parent the model to your character (no, it shouldn’t be a tool) and create a joint.

I usually use motor6ds for joints related to the character, you should look into the C0 property (offset from the Part0 of a motor6d) and construct a new CFrame (with CFrame.new() and CFrame.Angles())
here would be an example of code using the property C0.

local char = player.Character
local root = char.HumanoidRootPart
local box = char.Box
local motor6d = box.Motor6D
motor6d.Part1 = box
motor6d.Part0 = char.HumanoidRootPart
-- if you haven't learned about cframes yet, i suggest learning about it right now.
local positionalOffset = CFrame.new(0,5,-5) -- in this case, it would be 5 units above the humanoidrootpart and 5 units in front of it too.
local OrientationalOffset = CFrame.Angles(math.rad(90),math.rad(0),math.rad(0)) -- we use math.rad() since CFrame.Angles() takes radians. it will tilt it 90 degrees in the x axis relative to the humanoidrootpart.
motor6d.C0 = positionalOffset*OrientationalOffset -- so it will be 5 units in front of the humanoidrootpart, 5 units above it, and will be tilted 90 degrees in the x axis relative to it.
5 Likes

Hey, I have a problem like this, what should I do?

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local uppertorso = char:WaitForChild("UpperTorso")
		for i,v in pairs(plr.Backpack:GetChildren()) do
			if v:IsA("Tool") then
				for j,b in pairs(v:GetChildren()) do
					if b:IsA("MeshPart") or b:IsA("Part") then
						if b.Name == "Handle" then
							local clonedB = b:Clone()
							clonedB.Parent = uppertorso
							local weld = Instance.new("Motor6D")
							weld.Parent = uppertorso:FindFirstChild("Handle")
							weld.Part0 = uppertorso
							weld.Part1 = uppertorso:FindFirstChild("Handle")
							weld.C0 = uppertorso.CFrame
							local positionalOffset = CFrame.new(Vector3.new(uppertorso.Position.X,uppertorso.Position.Y,uppertorso.Position.Z+0.65))
							local OrientationalOffset = CFrame.Angles(math.rad(0),math.rad(180),math.rad(45))
							weld.C1 = positionalOffset*OrientationalOffset
							clonedB.CanCollide = true
						end
					end	
				end
			end
		end
	end)
end)