Help me decresing the particles rate

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Hello ! I’m working on a weather system for my game. And I had a problem and that is that i want to decrease the particles slowly and then destroy it for a smooth effect.

  2. What is the issue? Well, I’ve coded this and I tried a ton of more methods and nothing works, yet.

	for _, stuff in pairs(workspace.RainStuff:GetDescendants()) do
		if stuff:IsA("Model") or stuff:IsA("Sound") then
			for _, Parts in pairs(RainPart:GetDescendants()) do
				local Particles = Parts:FindFirstChildWhichIsA("ParticleEmitter")

				if Particles then
					local targetRate = 0.5
					local DecreaseRate = 0.5  -- Decrease the rate more gradually for smoother transition
					local DelayRate = 0.1  -- Reduce the delay for quicker updates

					while Particles.Rate > targetRate do
						Particles.Rate = math.max(Particles.Rate - DecreaseRate, targetRate)
						wait(DelayRate)
					end
				end
			end

			wait(3)
			stuff:Destroy()
		end
	end

  1. What solutions have you tried so far? CHAT GPT, Remaking the script and bla bla

Do you have multiple ParticleEmitters in the same part which is the variable “Parts”? If so, it FindFirstChildWhichIsA() only returns 1 instance – not all of them. I’m a tad confused with what you’re asking.

Also, it’d be better to tween them than run the while loop like you’re doing.

yeah, I have multiple parts. How can I be able to fix that? And how can I use the Tween?

No, I mean do you have multiple ParticleEmitters in the same part?

What exactly is the issue you’re running into? Currently, without seeing any other code than what you’ve provided, you’re only doing 1 overall loop so if you add more instances on run-time to your “RainStuff” model / folder, it won’t do any of that.

As for tweening, check out this article TweenService | Documentation - Roblox Creator Hub

Hello ! I managed to fix the issue, I was just decreasing the rate of 1 part. Now It’s working fine, now I’m gonna try to learn the TweenService

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.