Once again I am asking for help with my particle module. I have a set intensity function. Simple, right? WRONG. The set intensity function of the module is broken and (mostly) will not function. Here’s my function (cut it out of the module):
function serverEffects.SetIntensity(particle, intensity)
local amountOfEffects = math.floor(intensity/200)
local lastEffect = intensity%200
serverEffects.effect = particle
if not particle:IsA("ParticleEmitter") then
serverEffects.effect = particle:FindFirstChildWhichIsA("ParticleEmitter")
end
serverEffects.effect.Rate = lastEffect
for i = 1, amountOfEffects+1 do
serverEffects.newIntensity = serverEffects.effect:Clone()
serverEffects.newIntensity.Rate = 200
print(serverEffects.newIntensity.Parent.Name)
end
end
I called the function already:
local module = require(script.Parent.ServerEffectsModule)
local test = module.Create("Fire", game.Workspace.Part)
module.SetIntensity(test, 300)
Here’s what I expect to happen. First it gets the amount of extra particle emitters to reach the intensity level (divide by 200), gets the leftover bits (mod), finds the original particle, sets its to the leftover intensity, and starting from 1 to 2 (for loop, 2 is from 1+1 (first one from dividing)), adds more particle emitters and sets them to the max. After I print, it seems like newIntensity does not exist (attempt to index nil with Parent), and as a result, no extra particle emitters are created.
Edit 1: Renamed post to make it clearer
Edit 2: If you know the answer just please help. I’m bumping this up because nobody will reply, just view. Once again another bump, I still need help ya know