Attempt to perform arithmetic on nil and number when I clearly performed it on 2 numbers?

I’m making a particle effects module, and I’m making a SetIntensity function. (basically Rate but has higher limit) The title states my problem. I clearly used 2 numbers to perform division on.
Script Requiring module (test purposes)

local module = require(script.Parent.ServerEffectsModule)
local test = module:Create("Fire", game.Workspace)
module:SetIntensity(test, 300) --First number divided later

The module itself:

local serverEffects = {}
serverEffects.Fire = script.Fire
serverEffects.Smoke = script.Smoke
function serverEffects.Create(particle, parent)
	local folderToClone = script:FindFirstChild(particle)
	if folderToClone then
		local clone = folderToClone:Clone()
		clone.Parent = parent
	end
end
function serverEffects.SetIntensity(particle, intensity)
	local amountOfEffects = math.floor(intensity/200) --200, the second number involved in division. --Erroring line
	local lastEffect = intensity%200
	local effect = particle:FindFirstChildWhichIsA("ParticleEmitter")
	effect = lastEffect
	for i = 1, amountOfEffects-1 do
		local newIntensity = effect:Clone()
		newIntensity = 200
	end
end
return serverEffects
1 Like

Do not use : it will do

Module.SetIntensity(Module,test,blabla)

Use period instead.

Also your create function doesn’t seem to return anything.

1 Like

Right, I always forget about that. Thanks!

1 Like