So what we would first do is make the function.
function explode(part)
end
Now we will make a variable to access the torso.
local torso = part.Parent:FindFirstChild("Torso')
We now need to make sure that Torso actually exists, using if ~= nil then.
if torso ~= nil then
Now we do the explosions.
local explosion = Instance.new("Explosion")
explosion.Parent = torso
explosion.Position = torso.Position
The Finished Script
function explode(part)
local torso = part.Parent:FindFirstChild("Torso')
if torso ~= nil then
local explosion = Instance.new("Explosion")
explosion.Parent = torso
explosion.Position = torso.Position
end
end
We do not need to worry about the health, because the explosion will kill them anyways.
Please accept if helped.
Thank you.
2 comments
It does not make me explode
I don't know how to do explosions.