When I have 2 Models welded together and each has a Humanoid (such as the NPC, that I am welded to, because I am riding it) If one dies, it causes the other to die as well.
How can I weld these two models, (each containing a humanoid) together in a way that if one dies, it will not kill the other as well?
In the event that there is an npc, such as a large elephant, and several people ride it, and they are welded to it, if one character resets, til will not only kill the elephant but all the other players riding it.
I know this doesnt happen when you are connected via a seat object. But is there any other way to get the same safety as you do with a seat object, but not have to deal with a seat object.
Well in that case you need to destroy the weld before the character by detecting humanoid.Health value changed and is equal to zero.
Script in CharacterScript
script.Parent.Humanoid:GetPropertyChangedSignal("Health"):Connect(function()
if script.Parent.Humanoid.Health == 0 then
{select your weld here}:Destroy()
end
end)
I tried all over the place, even parenting it to different locations. The only thing that seems to work, is if I parent the weld in a seat object, and name it ‘SeatWeld’ It doesn’t have to actually ‘attach’ anyone to the seat weld, just be parented there.
I suppose I could just have one global seat object, and just parent all my welds there. Just so hack-ish
[EDIT] For anyone who uses this method, it will still kill all connected, if you set anyone’s health to 0 in the studio properties window. However, if you set someone’s health to 0 via a script, it will not kill anyone connected with a weld in the seat. This really confused me for a while, I thought the method had stopped working, but it was just an issue in changing things in the property window.
I had solved this in my old, R6 game. I did it by removing the HumanoidRootPart of the ‘non controlling’ model. And it worked ok, except for the pain of re-attaching the HRP, and resetting the root joint to its proper place.
However, I am converting all my code to R15, and Rthro, and apparently the R15 Humanoid will kill you instantly when you remove the HumanoidRootPart. So, not a valid solution anymore.
I think I will just use the Parenting to Seat solution for now. It forces the ‘non controlling’ model to be in a Humanoid.Seated state, but considering they are the non contorlling object, it shouldnt matter with animations applied.