✓ Accepted answer
I believe that the best option would be to have a block the size of the characters Torso that is welded to the backpack, and gets welded to the players Torso when they spawn or however you choose to do it.
Here is a script I made about a year ago to attach blocks to player's characters:
function Torso(char)
local g = game.ServerStorage.Backpack:Clone();
g.Parent = char;
local C = g:GetChildren();
for i=1, #C do
if C[i]:IsA("BasePart")then
local W = Instance.new("Weld");
W.Part0 = g.Middle;
W.Part1 = C[i];
local CJ = CFrame.new(g.Middle.Position);
local C0 = g.Middle.CFrame:inverse()*CJ;
local C1 = C[i].CFrame:inverse()*CJ;
W.C0 = C0;
W.C1 = C1;
W.Parent = g.Middle;
end;
local Y = Instance.new("Weld");
Y.Part0 = char:FindFirstChild("Torso");
Y.Part1 = g.Middle;
Y.C0 = CFrame.new(0, 0, 0);
Y.Parent = Y.Part0;
end;
local h = g:GetChildren();
for i = 1, # h do
if h[i]:IsA("BasePart") then
h[i].Anchored = false;
h[i].CanCollide = false;
end;
end;
end;
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(char)
wait(2);
Torso(char);
end);
end);
This code will move the model based on the piece called Middle (Note: This piece is the one that is the size of the Torso).
I hope this helped. If it did please accept this as the answer so that people know it has been solved.
5 comments
Thank you for your answer! I am getting an error on line 34 of your script where there was an expected ")" to close the statement. I also wasn't sure if I should place this script in ServerScriptService, StarterPack, or something else.
The error to his script is line 37/38, both must be
end)Due to your script being old, you may already know this, but you can say if part:IsA("BasePart") then.. This references all physicals parts such as Parts, Unions, Wedges, etc...
Okay so I have a Model with both the Filemesh and a weld part named "Middle" in it. This Model is in ServerStorage. I went to test it out and the model was not attached to my character. Does the script have to be local? Is the way I set it up incorrect?
If the model is in server storage you can't use a localscirpt. You would need to use a regular script. Hence why the game.Players.PlayerAdded at the bottom. alphawolves, I know about :IsA("BasePart") and I was really tired when I typed this script out so I blanked on a lot of things (i.e., the closing ')' on lines 37 and 38)