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.
You can do that by creating a weld and changing the CFrame of the Backpacks PrimaryPart.
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:
01 | -- Backpack model should be inside of the player's character |
02 | for i,v in pairs (script.Parent:GetChildren()) do -- Creates a for i,v in pairs() loop |
03 | if v.ClassName ~ = "Script" then -- Checks to see if the current item is not a script |
04 | local weld = Instance.new( "Weld" , v) -- Creates a new 'Weld' instance |
05 | weld.Name = "Weld" -- Names the weld to 'Weld' |
06 | weld.Part 0 = script.Parent.Parent.Torso -- Sets Part0 of the weld to the torso |
07 | weld.Part 1 = v -- Sets Part1 of the weld to the current item in the for loop |
08 | weld.C 0 = script.Parent.Parent.Torso.CFrame:inverse() -- Sets C0 to the CFrame inverse of the torso |
09 | weld.C 1 = v.CFrame:inverse() -- Sets C1 to the item's CFrame inverse |
10 | end |
11 | end |