- What do you want to achieve?
Make a crater at the explosion. (for technical people: I want to use SubtractAsync to make a hole in the affected parts). At the bottom of my post you will find my latest script.
- What is the issue?
Nothing happens
- What solutions have you tried so far?
checking for nearby parts, using explosion Hit event, adding parts to a table, etc.
local e = Instance.new("Explosion");
e.BlastRadius = power.Value;
e.BlastPressure = 1000000;
e.Position = this.Position;
e.Parent = game.Workspace;
local GeometryService = game:GetService("GeometryService")
local partsToSubtractFrom = {}
local parts = workspace:FindPartsInRegion3(Region3.new(this.Position - Vector3.new(power.Value, power.Value, power.Value), this.Position + Vector3.new(power.Value, power.Value, power.Value)), this)
for _, part in ipairs(parts) do
table.insert(partsToSubtractFrom, part)
end
local subtractedParts
for i = 1, #partsToSubtractFrom do
local craterVolume = Instance.new("Part")
craterVolume.Shape = Enum.PartType.Ball
craterVolume.Size = Vector3.new(power.Value, power.Value, power.Value)
craterVolume.Position = e.Position
craterVolume.Anchored = true
craterVolume.CanCollide = false
craterVolume.Transparency = 0.75
craterVolume.Parent = this
subtractedParts = GeometryService:SubtractAsync(partsToSubtractFrom[i], {craterVolume})
game.Debris:AddItem(craterVolume, 1)
end
for _, part in ipairs(subtractedParts) do
part.Parent = workspace
end
this:Destroy()