Region3 Doesn't Account For Objects Under Bomb


I’m trying to create my own script for a bomb I’m working for in my game, but I’ve come across an issue for all of the bombs in my game. The issue is, the region3 which deletes the parts that are caught in the bombs blast radius for some reason never takes in account for items that are under the bomb, it always goes above the bomb.

Here is an illustration of what I’m referring to.

As seen in the image, the region3 always is above the bomb and it won’t even effect the part under the bomb because it’s range doesn’t also include parts under the bomb. How can I do this with the current code that I have?

local blastRegion3L = 10/2 -- The Length of the Blast (Dividing all of the dimensions by 2 so that the region3 is not twice its size after making its size relative to the position)
local blastRegion3W = 10/2 -- The Width of the Blast
local blastRegion3H = 10/2 -- The Maximum height of the region3

local baseDamage = 25

. . .

local region3 =
		bomb.Position -, 1, blastRegion3W),
		bomb.Position +, blastRegion3H, blastRegion3W) -- Makes a square that is 5x5 long and wide, and 10 studs high (hence the 1 to 10)
	) -- Creates a region3 that destroys any parts in the explosions radius.

	local region3Visual ="Part") -- The visualized part for the region3.
	region3Visual.Name = "blastRadiousVisual"
	region3Visual.CanCollide = false
	region3Visual.Size = region3.Size
	region3Visual.CFrame = region3.CFrame
	region3Visual.Anchored = true
	region3Visual.Transparency = .5
	region3Visual.Parent = workspace.Terrain
	region3Visual.BrickColor ="Persimmon")
1 Like

If you want the region to take into account all parts below the bomb, you’ll simply need to shift the regions starting y value from 1 to blastRegion3H. This’ll make a perfect cube around your bomb, which may not be what you want as that may explode items too far down, so you’ll have to experiment with different Y values.

Anyways, this code should fix it. Replace it with the previous line, or simply just replace 1 with blastRegion3H.

bomb.Position -, blastRegion3H, blastRegion3W),
1 Like

Thanks, this ended up helping me, but when I posted in a development server about this issue, someone said this, do you know what there talking about?

Just means a new method/ service came out which replaces region3s and is supposedly more effective/ efficient. May also lead to the deprecation of region3, as there is a better alternative. I believe it is this: WorldRoot | Documentation - Roblox Creator Hub

1 Like

Ok, thanks for letting me know.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.