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 fog and sound work at the same time?

script.Parent.ClickDetector.MouseClick:Connect(function()
    if script.Parent.Value.Value == false then
        script.Parent.Value.Value = true
        for _,v in pairs(workspace.Lights:GetChildren()) do
            if v:IsA("BasePart") then
                v.Material = Enum.Material.Neon
                v.BrickColor = BrickColor.new("Fossil")
                v.SurfaceLight.Enabled = true
game.Lighting.FogEnd = ('100000')
            end
        end
    else
        script.Parent.Value.Value = false
        for _,v in pairs(workspace.Lights:GetChildren()) do
            if v:IsA("BasePart") then
                v.Material = Enum.Material.Glass
                v.BrickColor = BrickColor.new("Black")
                v.SurfaceLight.Enabled = false
				script.Parent.Switch.Play
wait(5)				
				script.Parent.Oof.Play
				game.Lighting.FogEnd = ('50')
				
				
					   
      	end
        end
    end
end)

1 answer

✓ Accepted answer
script.Parent.ClickDetector.MouseClick:Connect(function()
    if script.Parent.Value.Value == false then
        script.Parent.Value.Value = true
        for _,v in pairs(workspace.Lights:GetChildren()) do
            if v:IsA("BasePart") then
                v.Material = Enum.Material.Neon
                v.BrickColor = BrickColor.new("Fossil")
                v.SurfaceLight.Enabled = true
            end
        end
	game.Lighting.FogEnd = 100000
    else
        script.Parent.Value.Value = false
        for _,v in pairs(workspace.Lights:GetChildren()) do
            if v:IsA("BasePart") then
                v.Material = Enum.Material.Glass
                v.BrickColor = BrickColor.new("Black")
                v.SurfaceLight.Enabled = false
                script.Parent.Switch:Play()
wait(5)             
                script.Parent.Oof:Play()
                game.Lighting.FogEnd = 50
        end
        end
    end
end)

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