How to make a ParticleEmitter with a script

I want the player to have a effect on their feet when they run. I need help creating a ParticalEmitter. How do I do it?

The script is in StarterCharacterScripts

local Effect = Instance.new("ParticleEffect")

Effect.Color = BrickColor.White()
Effect.Lifetime = 1.5
Effect.Rate = 1
Effect.Rotation = -360,360
Effect.RotSpeed = 20
Effect.Speed = 5
Effect.SpreadAngle = 0,45
2 Likes

To create a particle emitter you would just change your line on the creation to:

local Effect = Instance.new("ParticleEmitter")

There is also no “Feet” body part so for R15 you would either need to use RightFoot and/or LeftFoot or for R6 “Right Leg” and/or “Left Leg”.

Then it is just a matter of setting the values to the correct types they expect as the “Color” property expects a ColorSequence and some of the other properties actually expect a NumberRange so you must use those to set the values. You would also want to Destroy the Emitter in the InputEnded event otherwise you will have quite a few emitters in the character.

How do I do the rotation and spread angle

Effect.Rotation = -360,360
Effect.SpreadAngle = 0,45
1 Like

Why create it each time you need it?
You can just use this setup to load it into the player with a script in the Starter Player Script service and make it Enabled = false.
Then when they run you just enable it and disable it when they stop running without Destroying it.
Also, remember that it’s ParticleEmitter, not ParticalEmitter.

I don’t know how to do that. How do I only make it once

ParticleEmitterHere:Emit(<number of times you want it to emit>)

I have never seen that. How does that work.

It’ll emit the particle 40 times. if you did :Emit(40).

As I already stated, you just need a Local script inside your StarterPlayerScripts | Documentation - Roblox Creator Hub that will create, format and place the ParticleEmitter into the Player. That way when the player loads into the game or respawns the Emitter is already loaded into their avatar and you can just Enable it true or false.

I got it

local player = game.Players.LocalPlayer
local character = player.Character

local function connectCharacter(character)
	local emitter = Instance.new("ParticleEmitter")
	-- Apply settings
	emitter.Parent = character:WaitForChild("HumanoidRootPart")
end

player.CharacterAdded:Connect(connectCharacter)

if character then
	connectCharacter(character)
end

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