Particles stop emitting after a few seconds (bug?)

I don’t know whether i should put this up as a bug report. or a scripting problem

So, basically I am trying to create a blizzard script that uses a lot of particles to create this really nice snowy effect. Though there’s this really strange bug/problem. The particles will stop emitting after a few seconds of running the game.

Also if you are wondering why i am using Particle:Emit() instead of Particle.Enabled is because i am trying to force more particles on the user’s screen instead of being limit with a few particles.

As shown here:

I have no clue why this is happening. Some help will be very much appreciated as always

local Camera = workspace.CurrentCamera

local RS = game:GetService("RunService")
local UGS = UserSettings():GetService("UserGameSettings")

local Character = script.Parent

local SnowPart = script:WaitForChild("SnowPart")
local particleEmitter = SnowPart:WaitForChild("ParticleEmitter")
local EmitterEnabled = script:WaitForChild("EmitterEnable")
local Sound = script:WaitForChild("BlizzardSound")

local CurrentParticleEmitRate = 10

SnowPart.Parent = Camera

local AudioMuted = true

function ToggleBlizzard(On)
	if On == true and AudioMuted then
		AudioMuted = false
		particleEmitter.Enabled = true
		for i = 1, 10 do
			wait()
			--particleEmitter.Transparency = NumberSequence.new(particleEmitter.Transparency + 0.05)
			Sound.Volume = Sound.Volume + 0.05
		end
		Sound.Volume = 0.5
	elseif not AudioMuted and On == false then
		AudioMuted = true
		particleEmitter.Enabled = false
		for i = 1, 10 do
			wait()
			--particleEmitter.Transparency = NumberSequence.new(particleEmitter.Transparency - 0.05)
			Sound.Volume = Sound.Volume - 0.05
		end
		Sound.Volume = 0
	end
end

function CheckGraphicsQuality()
	if UGS.SavedQualityLevel == Enum.SavedQualitySetting.QualityLevel1 then
		CurrentParticleEmitRate = 5
	elseif UGS.SavedQualityLevel == Enum.SavedQualitySetting.QualityLevel1 then
		CurrentParticleEmitRate = 5
	elseif UGS.SavedQualityLevel == Enum.SavedQualitySetting.QualityLevel2 then
		CurrentParticleEmitRate = 6
	elseif UGS.SavedQualityLevel == Enum.SavedQualitySetting.QualityLevel3 then
		CurrentParticleEmitRate = 6
	elseif UGS.SavedQualityLevel == Enum.SavedQualitySetting.QualityLevel4 then
		CurrentParticleEmitRate = 7
	elseif UGS.SavedQualityLevel == Enum.SavedQualitySetting.QualityLevel5 then
		CurrentParticleEmitRate = 7
	elseif UGS.SavedQualityLevel == Enum.SavedQualitySetting.QualityLevel6 then
		CurrentParticleEmitRate = 8
	elseif UGS.SavedQualityLevel == Enum.SavedQualitySetting.QualityLevel7 then
		CurrentParticleEmitRate = 8
	elseif UGS.SavedQualityLevel == Enum.SavedQualitySetting.QualityLevel8 then
		CurrentParticleEmitRate = 9
	elseif UGS.SavedQualityLevel == Enum.SavedQualitySetting.QualityLevel9 then
		CurrentParticleEmitRate = 9
	else
		CurrentParticleEmitRate = 10
	end
end

UGS.Changed:Connect(CheckGraphicsQuality)
CheckGraphicsQuality()

RS.RenderStepped:Connect(function()
	SnowPart.Position = Camera.CFrame.Position + Vector3.new(0, 50, 0)
	local rayOrigin = Camera.CFrame.Position
	local rayDirection = Vector3.new(0, 500, 0)
	
	local raycastParams = RaycastParams.new()
	raycastParams.FilterDescendantsInstances = {SnowPart, Character}
	raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
	
	local ray = workspace:Raycast(rayOrigin, rayDirection, raycastParams)
	
	if ray then
		local hitPart = ray.Instance
		if hitPart or EmitterEnabled.Value == false then
			ToggleBlizzard(false)
		else
			particleEmitter:Emit(CurrentParticleEmitRate)
			--print(CurrentParticleEmitRate)
			ToggleBlizzard(true)
		end
	else
		particleEmitter:Emit(CurrentParticleEmitRate)
		--print(CurrentParticleEmitRate)
		ToggleBlizzard(true)
	end
end)

Roblox has a particle limit once you exceed that limit it stops rendering them until they are within the limit.

2 Likes