Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I restrict an explosion from exploding/killing its Owner?

Asked by
iLordy 27
4 years ago
Edited 4 years ago

Im trying to find a way to restrict an explosion like from a bomb or a rocket launcher to stop being able to kill the person who launched the rocket or triggered the bomb. If anyone could please help I would greatly appreciate it, I'm guessing it would have to be something with getting the parent humanoid of the bomb and making it unaffected by it.

0
an explosion wont kill its parents cus it has no parents TheluaBanana 946 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

ill just quote this first part directly from wiki:

"If a developer doesn’t want joints between BaseParts to be broken or wants to implement their own formula for damaging Humanoids it is recommended they set Explosion.DestroyJointRadiusPercent to 0 and use the Explosion.Hit event to handle the result of the explosion."

a humanoid only dies from an explosion cus the explosion breaks the neck joint of the humanoid. If u make an explosion not destroy any joints, u can effectively prevent any humanoids from dying to ur explosion. However, same goes for the enemies. To prevent this, u have to use explosion.Hit to filter ur humanoid but damage the enemies:

 -- assuming u have already defined the (Explosion) and your (own player's humanoid) -- 

(Explosion).DestroyJointRadiusPercent = 0

(Explosion).Hit:Connect(function(part, distance)
    local hum = part.Parent:FindFirstChild("Humanoid")

    if hum and hum ~= (own player's Humanoid) then
        hum:TakeDamage(100)
    end
end)    

or idk maybe there is a better way like an ignoreList

Ad

Answer this question