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

How to make an explosion do no damage? [closed]

Asked by
obcdino 113
8 years ago

I want to create an explosion, but I don't want it to do damage/do a certain amount.

I thought blastpressure would affect it, but it turns out it doesn't after I read the help.

So, does anyone know how?

0
Please post your code. Tigerism 220 — 8y
0
I don't really need a script to change blastpressure, it's a property. obcdino 113 — 8y

Closed as Not Constructive by Tigerism, User#5978, docrobloxman52, and LegitimatlyMe

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
1
Answered by
pyro89 50
8 years ago

I'm pretty sure BlastPressure does affect the damage done to a humanoid affected. As stated in the ROBLOX wiki page, all parts in the blast radius have a force applied to them, applied based on the Blast Pressure. By setting the DestroyJointRadiusPercent value of the explosion to 0, welds will not be destroyed and the player won't be instantly killed. There is also an event that occurs when the explosion hits a part, called Hit with the parameters of the part itself and the distance.

If you script an explosion to hit a player and do specific damage, it MIGHT look something like this.

local Explosion = game.Workspace.Explosion -- This is only done assuming that there is already one in the workspace. You do not need this if you already have an explosion described, with the above-stated low Blast Pressure and low DestroyJointRadiusPercent values.

local Damage = 50 -- The damage that will be done to a player.

Explosion.Hit:connect(function(Part, Distance) -- When the Explosion hits a Part from a Distance of several studs away...
    if not Part or not Part.Parent then return end -- If the part doesn't even exist anymore, skip it.
    if Part.Parent:FindFirstChild("Humanoid") == nil then return end -- If there is no human, skip it.
    local Humanoid = Part.Parent:WaitForChild("Humanoid") -- Since there is a humanoid, describe it.
    Humanoid:TakeDamage(Damage) -- Make the human take the given damage.
end)
Ad