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

How activate Particle Emitter only when running?

Hi

I have a problem and i can't figure it out. How can you add a particle emitter to the torso of the players and the other question is how can i only activate the particle emitter when the player is running on walkspeed 30?

Here is what i got

local speed = Instance.new("ParticleEmitter",game.Workspace.player.Torso)
speed.Texture = "http://www.roblox.com/asset/?id=281983189"
speed.Size= NumberSequence.new(3)
speed.LightEmission = 1
speed.Color = ColorSequence.new(100, 11, 11)
speed.Acceleration = 1,1,1
speed.Lifetime = NumberRange.new(1)
speed.Speed.Value = 5

1 answer

✓ Accepted answer
local plr = game.Players.LocalPlayer

local char = plr.Character

local hum = char.Humanoid

hum.Running:connect(function(speed)
	if speed > 30 then
		
	-- DO STUFF:

	else

	-- DO STUFF:

	end
end

That would be the solution to your problem.

I hope with this you can set up and adapt your script to it.

Remember Humanoid has a Running event.

9 comments

0

at do stuff do I need to add in my script there or what is the intended sorry I'm new in scripting

0

Yeah, if speed > 30 then is for when the character is running, and you put the stuff u want to happen there so it triggers when the character runs, the else block is when the character doesn't run. So it triggers when he's standing still.

0

Where must i put the script in?

0

and is it localscript or script sorry for the questions haha i am still learning scripting on roblox :)

0

It's a localscript, and normally localscripts go in StarterGui / StarterPack / StarterCharacterScripts / StarterPlayerScripts.

0

thanks i will try it out after school i let you know if it works

0

i get a error " Error: (28,1) Expected')'(to close'('at line 9),got

0

Add end) at line 17, instead of end, add "end)"

0

It works now thankss

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