Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

I made a backpack, how do i have it so it stays on the back of a character?

Asked by
wookey12 174
7 years ago

I made this backpack that i wanted to stick on the back of all characters in the game from the start. How would i do this.

0
maybe make it a hat? and put it inside of a character when they enter the game or respawn? rareheaddress 74 — 7y
0
you can do like rareheaddress and make of it a hat, or you can make of it by example a CSG model and weld it to the player's torso loulou1112 35 — 7y

2 answers

Log in to vote
1
Answered by 7 years ago

You can do that by creating a weld and changing the CFrame of the Backpacks PrimaryPart.

0
ok I'll try and see what i can do, thanks for helping me wookey12 174 — 7y
0
may i ask what do you mean by a weld? also should the backpack be a tool? wookey12 174 — 7y
0
No, make the backpack a normal model or Union or whatever. You should make a script that uses the Touched Event. For welding help, use this to learn how to use it. https://www.youtube.com/watch?v=eBMWLUAgNMs xXLegendarySoldierXx 129 — 7y
0
You should weld the backpack to the Players Torso, just set the CFrame up to get it on their back. xXLegendarySoldierXx 129 — 7y
0
k thanks wookey12 174 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

You could create a weld. You didn't exactly provide that much information, although I'm going to assume your backpack is a model. I'm also assuming that you're moving the model into the player's character. This script would be put inside of the model:

-- Backpack model should be inside of the player's character
for i,v in pairs(script.Parent:GetChildren()) do -- Creates a for i,v in pairs() loop
    if v.ClassName ~= "Script" then -- Checks to see if the current item is not a script
        local weld = Instance.new("Weld", v) -- Creates a new 'Weld' instance
        weld.Name = "Weld" -- Names the weld to 'Weld'
        weld.Part0 = script.Parent.Parent.Torso -- Sets Part0 of the weld to the torso
        weld.Part1 = v -- Sets Part1 of the weld to the current item in the for loop
        weld.C0 = script.Parent.Parent.Torso.CFrame:inverse() -- Sets C0 to the CFrame inverse of the torso
        weld.C1 = v.CFrame:inverse() -- Sets C1 to the item's CFrame inverse
    end
end

Answer this question