Hello,
I am currently scripting some handcuffs. I am using a WeldConstraint to weld the characters together to do the detain. The problem is that when the detained person dies, so does the person who detained them. I have heard this is from the characters being welded together so they both die. Does anyone have some way to prevent this or something that acts like a weld that won’t kill both players when the detained one dies?
Things I’ve Tried
Using the .Died event when the detained person dies.
Storing the weld some where outside of the 2 characters.
Using any alternatives I could think of that may have acted like the WeldConstraints, regular welds and Motor6D’s.
The block puts the character’s health to 0 and to destroy the weld you would have to use the .Died event, which as I mentioned in my post, I already tried and it did not work because the character is already dead by the time it fires the event where you would delete the weld.
I used Character:BreakJoints() instead of setting the humanoid’s health to 0 and that worked. Could you try and use that method instead of setting the humanoid’s health to 0?
If that doesn’t work, could you try setting the Part0 and Part1 to the respective players’ HumanoidRootPart?
BreakJoints() does make it where both don’t die but there will be guns in my game so it won’t work out that way unfortunately. Also Part0 and Part1 are already set to their HumanoidRootParts.
No matter if you use BreakJoints() or Health = 0. The only important thing is to set Part0 or Part1, to nil before apply the death.
@7z99 Is right. Why not on touch event, the Part0 or Part1 = nil line just before Health = 0 ?
Or just destroy the weld, you gonna create a new one when another guy is captured, isnt?
I believe try disabling Humanoid.BreakJointsOnDeath on death. This is because the humanoid when dying destroys all connections including the new weld to the player cuffing the other player which kills them, same goes for vehicles.
So yeah perhaps make a custom death event or disabling that property.
I believe this is why in some other games they use a heartbeat connection to psuedo CFrame weld the handcuffed person in order to avoid this issue.
I would have to do that when the player dies, and the way the guns work is using raycasts then applying damage. The only way to detect that would be the .Died event which does not work because of it not firing in time.
Disabling BreakJointsOnDeath still kills the other player sadly. Might just have to go for CFrame type cuffs, but those don’t do movement as smoothly as welds.
Do you know how to make it where the CFrame is almost as smooth as a weld and doesn’t lag behind when moving? The Heartbeat connection makes it look jumpy and lag behind when moving.
I had this issue but it doesn’t just happens with this. It happens to all the Player is weld. I was riding an animal which had an Humanoid in. I reset my character and the animal died as well, I think because of the weld that the seat inserted. Idk what to do in this case though, just not use welds maybe?