Explosion radius in a nuke

How could I make a explosion radius for a nuke?
Basiclly a cylinder that expands and turns everything it touches into rust.

I already tried doing it by using :GetTouchingParts(), but it was extremly laggy.
And of course I cant really use the Touches event because the explosion radius would be anchored.

What is the best way to achieve this?

you would have to loop through the children of workspace, measure the distance between the value and the nuke, if its less than 50 for example then change the material to rust

1 Like

im sure there are other ways but that’s the method I would probably use

Have you combining find children and Magnitude? Not really sure tho

well actually I would probably use .Touched but for some reason he says he doesn’t want to use that :man_shrugging:

1 Like

Maybe you could loop through every part in the Workspace, and calculate the time it takes for the nuke to reach it using the distance from ground zero and the speed of the explosion. So you only have to loop through all of the parts once.

EDIT: nvm exhasuted allowed execution time

1 Like

Didn’t you read? That’s because the explosion radius is anchored, and .Touched only works on parts that are part of a physics movement. An anchored part changing size is not a physics movement.

1 Like

Try Region3 from sphere: Rotated Region 3 Module

You can pass your own ignorelist and whitelist.


I’ve got another idea: Store a list of each part’s distance from ground zero, and the part itself. Then, while the nuke is running, iterate through the list every frame. If the part is inside the expanding blast radius, then change its look and delete the part from the list.

I’ve tried this and it works well. I put an array of nine Crossroads and the Effiel Tower and in the beginning it runs at around 16 FPS, I think. Here is a video showing this: nuke.wmv (4.4 MB)

EDIT: i somehow forgot the post the code and then i closed the place with the code and it’s gone forever now

Can I increase the size of the region somehow?
I saw a Region3.Size property, can I change it?

you can use GetTouchingParts()

do this everytime you resize or as you are resizing
then iterate through them and do what you need to the parts

local Part = workspace.Nuke
for i, touched in ipairs(Part:GetTouchingParts()) do  -- this will get table of parts it is touching and check if the material is set to corrod if not it sets it 
	if touched.Material ~= Enum.Material.CorrodedMetal then
		touched.Material = Enum.Material.CorrodedMetal

if you are using a not collide part then you will need to setup a function with a temp connection to Part.Touched then call the gettouchingparts on the part
then diconnect it and send results back

1 Like

I already tried it before making the topic but it was extremly laggy, read the topic again

Calculate the distance of the player from the cylinder’s X and Z and if the distance is lower than the cylinder size turn them into rust

1 Like