Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How activate Particle Emitter only when running?

Asked by 8 years ago

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

Log in to vote
1
Answered by 8 years ago
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.

0
at do stuff do I need to add in my script there or what is the intended sorry I'm new in scripting robloxy0123 30 — 8y
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. iDarkGames 483 — 8y
0
Where must i put the script in? robloxy0123 30 — 8y
0
and is it localscript or script sorry for the questions haha i am still learning scripting on roblox :) robloxy0123 30 — 8y
View all comments (5 more)
0
It's a localscript, and normally localscripts go in StarterGui / StarterPack / StarterCharacterScripts / StarterPlayerScripts. iDarkGames 483 — 8y
0
thanks i will try it out after school i let you know if it works robloxy0123 30 — 8y
0
i get a error " Error: (28,1) Expected')'(to close'('at line 9),got<eof> robloxy0123 30 — 8y
0
Add end) at line 17, instead of end, add "end)" iDarkGames 483 — 8y
0
It works now thankss robloxy0123 30 — 8y
Ad

Answer this question