Welds not working properly

I’m currently making a gun kit, with the hopes of using bullet holes that can attach to objects and stay with them. (realism) Although I do not often experiment with welds, it confuses me on how this doesn’t work.

local WeldConstraint = Instance.new("Weld")
WeldConstraint.Name = "BulletWeld"
WeldConstraint.Parent = bulletPart
WeldConstraint.C0 = bulletPart.CFrame:Inverse() * ServerHitObj.CFrame -- most complicated thing ive ever done
WeldConstraint.Part0 = bulletPart
WeldConstraint.Part1 = ServerHitObj

The welds for some reason don’t stick to the target at all and just fall off. How can I fix?

Is bulletPart supposed to weld to ServerHitObj? If so, switch Part0 with Part1. Part0 is what the part will be welded to while Part1 is the part itself.

Yes it is. I’ll try that out as soon ASAP.

It appears that it did not work whatsoever.

local WeldConstraint = Instance.new(“Weld”)
WeldConstraint.Name = “BulletWeld”
WeldConstraint.Parent = bulletPart
WeldConstraint.C0 = ServerHitObj.CFrame:Inverse() * bulletPart.CFrame – most complicated thing ive ever done
WeldConstraint.Part0 = ServerHitObj
WeldConstraint.Part1 = bulletPart

You need to attach the C0 and the C1 to each of the Parts.
Why don’t you just Anchor the bulletPart? It would be much easier than trying to weld it.

Thing is; I’m going for realism.

I want the holes to move with the object, not just float in mid air.

There doesn’t appear to be anything inherently wrong with your script, so perhaps the issue stems from somewhere else.

Is there any code that could potentially break the weld, such as something calling :BreakJoints()?

Are both Part0 and Part1 owned by the same party? If one of the parts is being simulated by the server while the other is created by/owned by the client, there may be some issues.

Are you using raycast for the hit detection?

But did you see the first line of my post?

You haven’t specified the C1 of the weld.

I have found a solution to this problem. You don’t need to set the C0, However you need to set the C1.

Example:

WeldConstraint.C1 = ServerHitObj.CFrame:Inverse() * bulletPart.CFrame
WeldConstraint.C0 = nil