Weld Breaking on Humanoid Death problem

There’s a problem in my game that I’m trying to solve but I’m having a difficult time doing so.

In my game I have landing craft that transports NPCs to the beach which has a Humanoid inside and everything inside is welded properly using Motor6D welds.

When the landing craft is spawned, a script is called unto it and it’ll load NPCs inside with the capacity it has and transports the boat to the beach. Everything works fine until the Humanoid on the boat dies.

The boat is suppose to be destroyable, but when the Humanoid dies, all of the NPCs that have their Motor6D weld attached to the boat instantly dies too. I’ve been trying to figure out the problem and thought it was something with the boat’s explosion that was killing the NPC but even after making the NPCs immortal, they still instantly died. I’ve disabled the explosion handling entire and just let the humanoid itself die but it still happens. And it’s not the NPCs attached to the boat doing it because when I kill off the NPC inside the boat, the boat still travels and all of the other NPCs remain fine.

I’ve disabled BreakJointsOnDeath and the boat doesn’t fall apart when the humanoid dies but the NPCs that are still welded to the boat still instantly died. I’ve tried re-parenting the welds from inside the NPC into the boat but the results are still the same, and I’m having trouble. Anyone know a solution to fix this?

Here’s a GIF below of it happening: I’ve ran a code to just set the boat’s humanoid health on zero while the boat is traveling across the water with CFraming methods.

GIF: https://gyazo.com/9e4a17f99daaea7953819784f86a864b

If there isn’t a solution for it, is there a good alternative I can use to keep a NPC/Player placed in a fixed position while being traveled with the model?

1 Like

What you could do is, when the player is on the boat, disable their Dead HumanoidState using Humanoid:SetStateEnabled. When their health = 0, delete the Motor 6D and then enable their Dead state.

1 Like

You could disable, Humanoid.BreakJointsOnDeath

If you want the boat to break apart, consider using Model:BreakJoints.

Misinterpreted, you should create an artificial explosion when a custom ‘health’ is on the boat model. The boat model will not use a Humanoid, with proper filtering on which models within the models should :BreakJoints() would be ideal.

Analysis


What happened was when the Humanoid of the model “died”. It uses Model:BreakJoints(), which causes all joints within the model including the NPC to break apart, and die.

They stated it in their thread :stuck_out_tongue:

Why is BreakJoints being called when I have BreakJointsOnDeath set to false?

Question is if you’re using two Humanoids. If you do, make sure to separate them from the model. NPC as itself a model as well as the boat.

All of the other NPCs attached to the boat remain in the workspace as their parent.

My boat has torso-holding parts in it and these are configured for vehicles, giants. NPCs, players, and etc. https://gyazo.com/0b98187881562aecd8165bb5358315bb

In the game, boats are cloned into the workspace and after doing so, it generates some NPCs to spawn in it (those NPCs are parented into the workspace): certain types of NPCs are welded into their specific type seats (if there’s any available and not taken). Once a seat is claimed, the NPCs are CFramed into it, and then I call in a Motor6D weld into it so it can be welded into it.

After all of the NPCs are loaded into it, the boat begins to move using CFraming TweenService (all of the other parts inside the boat are welded together, and only one main part of the boat is anchored and I only call tweening on that anchored part.)

I think I’mma try using alignment but…

Is AlignOrientation and AlignPosition a reliable object to use in your game? I’ve never used it before but I think that sounds like a good idea to give it a try.

Looking at the wiki though, I’m concerned it might use a lot of physics. Often times each boat can carry up to 10 NPCs (and even 2 players) at max and frequent boats are deployed frequently. It is possible to have 32 humanoids on multiple boats in the water at the same time and having 64 alignments continuously applying force without causing server issues? Like I said, I never used these instances before and you suggesting it, I think you had use them before so is it still a good idea to use?

Parts of boat > welded to main part
Parts of NPC > welded to connected parts, like hand to lower arm to upper arm
NPC Root > welded to boat main
Boat dies > Call :BreakJoints on main part (break apart the boat and unhook the NPCs)

Also, make sure the NPC has the root part. As far as I can tell you don’t need to weld it or anything at all.

Do try to use; https://www.roblox.com/library/1664543044/R15MrGreyNew

Don’t bother with the attachments at the moment, try to make sure your stuff is just setup properly. You probably did something wrong in your code that you’re missing.

Huh? I decided I had to weld the NPC to the boat because it moves using CFraming, I don’t understand why you say I don’t need to weld it to the boat holder or to do anything? Also I’m not sure why you just posted that R15 figure.

You should ONLY weld the single root part of the npc to the boat, the link is Roblox’s R15 rig. I tried to describe the order of how things should be welded for each object and how they should be connected.

Yes, I’ve been welding to the NPC’s HumanoidRootPart to the part holder. I’ve been generally welding properly from limb to limb.

You mis-read what I was saying. I was saying to weld the Root Part to the boat’s main part. No other part of the NPC should be welded to the boat in any way, they shouldn’t die with the boat this way. Typically they die from being welded to a part that gets moved and breaks their own joint (I believe only old welds do this.)

Just to be sure, you are using?;

https://developer.roblox.com/api-reference/class/WeldConstraint

Testing out my own rough type example, they don’t die for me. I must ask, why are you using a humanoid on the boat itself…?

i’d just have a number value inside it representing the health, and when I change it just check to see if its low enough to be dead.

Again, I’ve been using Motor6D to weld my NPCs into the boat.

I’ve changed the welding technique from the holder to the boat’s main part and it still doesn’t work: having the humanoid die on the boat causes all of the other NPCs welded on the boat to die still.

Try this;

  • Make all the Motor6Ds inside the NPC and nothing connecting to the boat
  • Weld the NPC’s root to the main part of the boat and ONLY this part using a WeldConstraint

Do exactly this and tell me if it works.

After doing this: with all of the Motor6Ds inside of the NPCs with none of them connecting to the boat, making a WeldConstraint and only having the WeldConstraint connect to the NPC’s root and the boat’s main part, when the boat dies all of the NPCs inside of the boat still die.

It looks like you’ve found a bug D: Unless Humanoids are seated into the boat (by the game engine via touching the seat or seat:Sit(humanoid) – not by creating a weld named SeatWeld), it appears that BreakJointsOnDeath does not work properly down the attached hierarchy of humanoids.

Until this is fixed, you can use Seats & seatPart:Sit(npcHumanoid) to attach the NPCs to the boat instead of normally welding them. You can enable seatPart.Disabled if you don’t want players to be able to enter the seats once NPCs leave them – calling sitPart:Sit() through the API will still work

1 Like

Do you want me to provide more information to help you with the bug or anything?

No need. I was able to create a repro based on what you had posted so far. Thanks!

2 Likes