local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() Mouse.KeyDown:connect(function(key) if key == "p" then local RinkakuModel = game.ReplicatedStorage.WorkspaceRinkakuModel:Clone() --Assuming the model is now in ReplicatedStorage local primary_part = RinkakuModel.Primary -- Since this is used a lot, let's store it in a temporary variable RinkakuModel.PrimaryPart = primary_part local w = Instance.new('Weld') w.Part0 = primary_part w.Part1 = Player.Character.Torso w.C0 = CFrame.new(0, 10, 0) w.Parent = primary_part primary_part.Anchored = true -- Not sure if you still need to anchor it, if not you can leave it out. for index = 1, 15 do local part = RinkakuModel["Part" .. index] -- This will generate Part1 till Part15 local weld = Instance.new("Weld") weld.Part0 = primary_part weld.Part1 = part weld.C1 = part.CFrame:toObjectSpace(primary_part.CFrame) weld.Parent = primary_part part.Anchored = true -- Same here with the anchoring return weld end RinkakuModel:SetPrimaryPartCFrame(Player.Character.Torso.CFrame * CFrame.new(0, 10, 0))-- It's probably a good idea to use SetPrimaryPartCFrame before parenting it. RinkakuModel.Parent = workspace RinkakuModel:MakeJoints()-- You don't need to use MakeJoints because you did that manually RinkakuModel.Name = Player.Name end end)
It should copy the model from replicated storage and weld its primary part onto my torso along with the other 15 parts in the model. However it isn't doing that and the output isn't saying anything either. This is a local script in starterpack, please help.
Here is your fixed code:
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() Mouse.KeyDown:connect(function(key) if key == "p" then if Player.Character:FindFirstChild("WorkspaceRinkakuModel") then return end local RinkakuModel = game.ReplicatedStorage.WorkspaceRinkakuModel:Clone() local primary_part = RinkakuModel.Primary RinkakuModel.PrimaryPart = primary_part local w = Instance.new('Weld') w.Part0 = primary_part w.Part1 = Player.Character.Torso w.C1 = CFrame.Angles(math.rad(90),math.rad(-90),0) w.Parent = primary_part for index = 1, 15 do local part = RinkakuModel["Part" .. index] -- This will generate Part1 till Part15 local weld = Instance.new("Weld") weld.Part0 = primary_part weld.Part1 = part weld.C1 = part.CFrame:toObjectSpace(primary_part.CFrame) weld.Parent = primary_part end RinkakuModel.Parent = Player.Character end end)
You do not want to Anchor welds. If you do that, the Player won't be able to move.
The actual issue with nothing happening is because you have return weld
on line 26: this exits the function. Additionally, the SetPrimaryPartCFrame
and MakeJoints
calls are redundant and unnecessary.
I suggest you read up on welds before you try and meddle with C1 and C0 more. It'll help. :)