Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do you add a Particle Emitter to a part using Instance.new?

I am trying to add a particle emitter to this attack , it causes the attack to just freeze in one place (it's a ranged attack) (it is the Y variable i'm trying to add)

for i = 1, 50 do
 wait(0.01)
 ShockWave1 = Instance.new("Part")
 ShockWave1.Parent = workspace
 ShockWave1.Size = Vector3.new(math.random(10, 10), math.random(10, 10), math.random(10, 10))
 ShockWave1.formFactor = "Symmetric"
 ShockWave1.Anchored = true
 ShockWave1.Shape = "Ball"
 ShockWave1.CanCollide = false
 ShockWave1.Transparency = 0.4
 ShockWave1.TopSurface = "Smooth"
 ShockWave1.BottomSurface = "Smooth"
zomg = math.random(1, 2)
 if zomg == 1 then
 ShockWave1.BrickColor = BrickColor.new("Really black")
 	end
 if zomg == 2 then
 ShockWave1.BrickColor = BrickColor.new("Black")
 	end
 m = Instance.new("CylinderMesh")
 m.Parent = ShockWave1
 m.Scale = Vector3.new(0.25*(i/2), 0.25*(i/2), 1.5*(i/2))
y=Instance.new("ParticleEmitter",ShockWave1)
y.Texture= "rbxasset://textures/particles/sparkles_main.dds"
y.Color=Color3.new(255,255,127)
y.LockedToPart=true
 ShockWave1.Name = "ShockWavePart"
	game.Debris:AddItem(ShockWave1, 0.2)

2 comments

0

y = Instance.new('Particle Emitter')

0

Thanks for the answer, this (like the answer below) inserts the particle emitter but it keeps making the projectile its being inserted into disappear

1 answer

This was something that took me forever to figure out finally i realized anything that has a space must be written like this ["i Hope this help"] for example in your situation it would be Instance.new(["Particle Emitter"]) or something around those lines try it out

1 comment

0

Thanks this does work , but it freezes the part its going into, for example without the particle emitter it looks like a tornado type projectile,but as soon as i add particle emitter it just looks like a head stuck in one place with the emitter

This discussion is preserved as it was. New answers, comments, and votes are closed.