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

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

`` 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) ``

4 comments

0

Maybe try putting the explosion in workspace

0

Oh and btw "fromRGB" doesn't work with parts try Color3.new instead

0

Why are you parenting it twice? Remove the second argument of Instance.new since you already set it with .Parent

0

Add WaitForChild too, could possibly be the problem

1 answer

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

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