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

Explosion Effect Not Appearing In "v" (I already fixed it myself)?

Asked by
O3hros -3
3 years ago
Edited 3 years ago

`` local MyFolder = game.Workspace.Assets.HouseParts

local MyTable = game.Workspace.Assets.HouseParts:GetChildren()

local function StartDemolishing()

for i, v in pairs(MyTable) do

    wait(3)

    v.Color = Color3.fromRGB(255, 52, 52)
    v.Material = "SmoothPlastic"

    wait(2)
    game.Workspace.Sounds.DestroySound:Play()
    print("Demolished")

    local explosion = Instance.new("Explosion", v) --The explosion doesn't appear?
    explosion.Parent = v
    explosion.Position = v.Position

    local sound = game.Workspace.Sounds.Explode
    sound:Play()


    v:Destroy()

end

end

local button = game.Workspace.Button2.Button

button.ClickDetector.MouseClick:Connect(function()

button.Color = Color3.fromRGB(255, 0, 0)
button.Material = "Neon"
button.ClickDetector:Destroy()

StartDemolishing()

end) ``

0
Maybe try putting the explosion in workspace MiAiHsIs1226 189 — 3y
0
Oh and btw "fromRGB" doesn't work with parts try Color3.new instead MiAiHsIs1226 189 — 3y
0
Why are you parenting it twice? Remove the second argument of Instance.new since you already set it with .Parent CoolBlueJay000 48 — 3y
0
Add WaitForChild too, could possibly be the problem CoolBlueJay000 48 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

You trying to change the color of a model I see

it's either you're just making an error

Here is the code that worked for me

for i, v in pairs(workspace:GetChildren()) do
if v:IsA("BasePart") then
    wait(3)

    v.Color = Color3.new(255/255, 52/255, 52/255) -- you can't use fromRGB on a part
    v.Material = "SmoothPlastic"

    wait(2)
    game.Workspace.Sounds.DestroySound:Play()
    print("Demolished")

    local explosion = Instance.new("Explosion", v)
    explosion.Parent = v
    explosion.Position = v.Position

    local sound = game.Workspace.Sounds.Explode
    sound:Play()


    v:Destroy()
end
end
Ad

Answer this question