How do I go about welding armour? I have a 3d model of armour I would like to weld to all characters, but I’m not sure how I can do it. I’ve searched everywhere on the DevForum but I can’t find anything that can help me. I thought of individually welding each meshpart to the character, and positioning each of them, but that would be really inefficient. Also, sorry if I got the wrong category or anything, this is my first post.
It would not be inefficient if you only do it when the character equips the armor, that is what all games do that have some sort of armor system. They usually force all characters to one type rig with a specific scale, and weld each piece of the armor to the respective body part.
How would I script this? I want to be able to weld the armour to an r15 character.
Take this function(really easy to weld things in all your scripts this way)
function weld(p0, p1, c0)
local w = Instance.new(“Weld”)
w.Parent = p0
w.Part0 = p0
w.Part1 = p1
w.C0 = c0
return w
end
then use it to weld and position how you want like so
weld(ARMORP, BODYP, CFrame.new(0,0,0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)))
(Sorry for the horrible formatting, this is my first post)
Would this not be really inefficient? Is there no way I can do multiple parts in just a couple lines of code? Like a loop?
Maybe there is something out there, but this way isn’t really that inefficient once you get used to it.
The positioning for most of your armors are probably going to be exactly the same if they’re not incredibly different.
Let’s wait and see if someone else comes up with anything in the meantime.
How I would do it is make individual piece of armor an accessory. You just need a part named Handle inside the accessory and an attachment that is named to one of the attachments inside the character. If you parent it to player on the server, it will automatically position itself.
That’s another way to go about it, but it doesn’t seem all that different from the weld method
Edit: Actually I stand corrected, just tried that out seems to be a little better
Yea it’s not much different than the weld method, but I’d say it’s easier to implement and setup your armor, and looks nicer when coding it
You could make the armor like a rig: https://gyazo.com/19375d3bc2b0b55b0e3d205a2ed598fe
and then use a loop to go through each part and then weld it accordingly
for i,v in ipairs(armor:GetChildren()) do
local bodyPart = char:FindFirstChild(v.Name)
if (bodyPart) then
local weld = Instance.new("Weld",bodyPart)
weld.Part0 = bodyPart
weld.Part1 = v
end
end
If your armor is offset a little (like a halo thingy above player head) then you can use an extra invisible part that is welded to the actual armor and is offseted, and then make the weld part1 to that invis part
EDIT: you also need to remove the humanoid and all motor6ds connecting the armor parts together
Hope this helps
Just used this method and it turned out to be really easy, marked it as solution, thanks for the help!