How would I go about attaching a backpack to the player?

I’m making a simulator, and I have a fully working backpack storage and selling script. at first, I couldn’t think of a way to get the backpack onto the player, so I finished the rest of the script, and made the backpack spawn on the ground somewhere, but inside the character model.

so now, how can I go about attaching it to the player? should I weld it to the upper torso? is there any tutorial I can follow to do that? thanks.

I would go with your initial assumption and weld the backpack to the upper torso. An example script that could be placed into StarterCharacterScripts or wherever your backpack script is:

local CFchar = script.Parent.UpperTorso.CFrame                          --the upper torso's CFrame

local weld = Instance.new("Weld")                                       --creates the weld
	weld.Part0 = script.Parent.UpperTorso
	weld.Part1 = workspace.Backpack                                      --the backpack part you're using

	weld.C0 = CFchar
	weld.C1 = CFrame.new(CFchar.X + 0, CFchar.Y + 0, CFchar.Z - 1)      --edit these lines if the backpack does not sit at the position you want

	weld.Parent = workspace.Backpack

image

4 Likes

I’d recommend using Accessories. They are so underrated. You basically need no scripting to do that.

Here is a reply from an other post where I learned how to do that (Its the reply from colbert2677): [Making Models wearable] How to make a basic Model, that isnt a Mesh wearable as a hat - Help and Feedback / Scripting Support - DevForum | Roblox

1 Like