Hey developers, I have been attempting to make an armour piece attach to a player, and once I welded it, it seems the top-half seemed to turn side wards and fall. I have no idea why and no idea how to fix it.
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local parts = script.Parent
for _, v in pairs(parts:GetChildren()) do
if v:IsA('MeshPart') or v:IsA('UnionOperation') then
local vestWeld = Instance.new('Weld', char.Torso)
vestWeld.Part0 = vestWeld.Parent
vestWeld.Part1 = v
end
end
end)
end)
Whilst player wearing
Regular Vest
Part hierarchy
Any solutions, recommendations or tips would be greatly appreciated.
Thanks.
You will have to mess around with it to get the perfect position. Set c0 to this: CFrame.fromOrientation(anglerX, angleY, angleZ) + Vector3.new(offsetX, offsetY, offsetZ).
If this is confusing, make it an accessory like @Redridge said.
you could weld all the parts of the vest to one main part which can be a rectangle which is easier to configure, and mess with the C0 and testing it. Or you could position it yourself on a model and find the object space and set that as your C0.
In this situation I would probably create an invisible part the size of the whole vest or at the center of the vest. Also make its Front/Back/Right/Left/Up/Down surfaces face the correct way. Make it not-collidable and weld the vest model to it using WeldConstraints.
Then change the primary part of the model to the invisible part.
Then, to position it just do model:SetPrimaryPartCFrame(HumanoidRootPart.CFrame).
Then create a WeldConstraint, set its Part0 to the invisible part, and Part1 to the HumanoidRootPart and parent it to the invisible part.