Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make a nuke explode in a building and make the building destroyed?

I am trying to make a script where a nuke explodes and then the building changes to a destroyed version but neither scripts are working for me. Here's the script:

game.Workspace.Nuke.Transparency = 0
game.Workspace.Nuke.CanCollide = true

local originPart = game.Workspace.Nuke
local radius = 1000

function killFromOrigin()
    for i,v in pairs (game.Workspace:GetChildren()) do
        local humanoid = v:FindFirstChild("Humanoid")
        local head = v:FindFirstChild("Head")
        if head ~= nil and humanoid ~= nil then
            if (originPart.Position - head.Position).Magnitude <= radius then
                humanoid.Health = 0
game.Workspace.ReactorCore1:Destroy()
local map = game.ServerStorage.ReactorCore2
map:Clone().Parent = game.Workspace

            end
        end
    end
end


1 answer

✓ Accepted answer

You may try making an explosion and un anchoring every part at the time of the explosion.

local children = game.Workspace:GetChildren()--Unanchor children
for i = if children:IsA("Part") then
	i.Anchored = false
end

local explosion = Instance.new("Explosion")--Create the explosion.
explosion.BlastRadius = 99999999999--Enoughly big to affect the entire nuke plant.
explosion.BlastPressure = 999999999999--Enoughly big to make fly even the biggest parts.
explosion.Position = Vector3.new(--Nuke.Position)

1 comment

0

None of the script is working as in the building isn't getting unanchored and there is no explosion I don't know why

This discussion is preserved as it was. New answers, comments, and votes are closed.