ParticleEmitter Size Property Not Working

Hello!
I am working on a tower defense game and I am attempting to add vfx to there attacks. It works right but they are ugly so I am upgrading them. I am doing this via a script. But when I attempt to modify the size of the particle emitter, everything breaks.

local function fireProjectile(tower, target)
	local projectile = Instance.new("Part")
	projectile.Size = Vector3.new(1,1,1)
	projectile.CFrame = tower.Head.CFrame
	projectile.Anchored = true
	projectile.CanCollide = false
	projectile.Transparency = 1
	projectile.Parent = workspace.Camera

	local emitter = Instance.new("ParticleEmitter")
	emitter.Texture = "rbxassetid://12390113643"
	emitter.Size = 10 -- the issue is here
	emitter.LightEmission = 1
	emitter.LightInfluence = 0
	emitter.Parent = projectile

When it tries to create the particle, it just gives me an error in the output. Saying:
image

It works if I use the default Roblox fire which is what I initially had it as.

local fire = Instance.new("Fire")
fire.Size = 2
fire.Heat = 0.1
fire.Color = tower.Config.Trail.Value
fire.Parent = projectile

My only idea as to why it doesn’t work is because by default particle emitters have the size set to “NumberSequence”
image

I’ve done some research and I can’t find out why it wont work.

Any help is appreciated!

2 Likes

This is quite the beginner mistake, and the error quite literally points out the issue.
The issue being, the Size property that particle emitters has accepts number sequences not normal number values.
To fix this issue, you would need to set the size property to a number sequence, like so:

emitter.Size = NumberSequence.new(4)

Tremble beneath my superior knowledge, amateur! (i’m, stupid don’t take me seriously…)

for more info on number sequences, click me

4 Likes

Thanks a lot man! As you can probably tell im not the most advanced coder. :rofl:

4 Likes

Oh, but of course! Thanks to your mistake, though it may be a small, overlooked one, will act as knowledge to any future searchers of the forum who had encountered your mistake!
You’re welcome, and have a great day creating your game!

4 Likes

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