Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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

Log in to vote
0
Answered by 4 years ago

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)
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 ConorG234 39 — 4y
Ad

Answer this question