Particle on a Humanoid

Whenever you can…check your messages!!

If i am wanting to put a particle into a player’s character i first put a ParticleEmitter in the StarterCharacterScripts, this is because all the scripts in there go into the player’s character. Next i put a Script in StarterCharacterScripts and i type this code.

local e = script.Parent.ParticleEmitter
local e2 = e:Clone() 


e.Parent = script.Parent.RightFoot
e2.Parent = script.Parent.LeftFoot

I hoped this helped! If you need me to explain it, i will if i can (depending on the time).

I recently tried this and it doesn’t seem to work. Meaning when I spawn it’s connected to my feet but when I move it doesn’t move with me

You can check my post:

That does help but that is not exactly what I am looking for. But I am going to use yours for a damage effect. @DevKaister response helps the most (waiting for his reply). But I’ll show you a showcase of what I am going to use yours for.

Aha, I have finally come up with a working solution that works well! I hope it works for you.

Put this in code in a LocalScript in StarterPlayer.StarterPlayerScripts.

The Code
-- The player.
local player = game:GetService("Players").LocalPlayer

player.CharacterAdded:Connect(function(char)
	-- Wait for the player's character to spawn.
	
	local humanoid = char:WaitForChild("Humanoid")
	
	-- Get the feet, so we can add particles to them.
	local leftFoot = char:WaitForChild("LeftFoot")
	local rightFoot = char:WaitForChild("RightFoot")
	
	-- Create the initial ParticleEmitter. You might want to tweak the rate, speed, etc.
	local particle = Instance.new("ParticleEmitter")
	particle.Texture = "rbxassetid://242008870"  -- Asset URI of the particle.  I just used a toolbox one here.
	particle.Rate = 5
	particle.EmissionDirection = Enum.NormalId.Back
	particle.Speed = NumberRange.new(1)
	particle.Lifetime = NumberRange.new(1, 2)
	
	-- Whether or not a ParticleEmitter already exists in the feet, so we don't accidentally make 2.
	local spawned = false
	
	local pClone = particle:Clone()
	pClone.Parent = leftFoot
	local rpClone = particle:Clone()
	rpClone.Parent = rightFoot
	
	pClone.Enabled = false
	rpClone.Enabled = false
	
	-- Keep checking whether or not the player is moving.
	while true do
		local val = humanoid.MoveDirection
		
		if((humanoid.FloorMaterial ~= Enum.Material.Air) and (val.X ~= 0 or val.Y ~= 0 or val.Z ~= 0)) then
			if(spawned == false) then
				-- Set spawned to true, so we know the ParticleEmitters are enabled
				spawned = true
				
				-- Enabled the ParticleEmitters.
				pClone.Enabled = true
				rpClone.Enabled = false
			end
		else
			if(spawned) then
				-- Set spawned to so we know that they are disabled.
				spawned = false
				
				if(pClone ~= nil and rpClone ~= nil) then
					pClone.Enabled = false
					rpClone.Enabled = false
				end
			end
		end
		wait()
	end
end)

Happy coding! :grinning:

where would I put the particles?

You don’t need to put them anywhere, the script creates the particles automatically.

Ah ok, let me try this real quick.

Hm, nothing works. Nothing in the output either.

Where did you put the script? This might be why.

StarterPlayer.StarterPlayerScripts

Sorry, I was out of town for the day. Are you using R6 characters or R15?

That’s Ok, I am using R6 Characters.

Oh, that’s why. The script was made for R15 characters.

Here’s an updated version of the script that supports both R6 and R15 character models:

Updated Script
-- The player.
local player = game:GetService("Players").LocalPlayer

player.CharacterAdded:Connect(function(char)
	-- Wait for the player's character to spawn.
	
	local humanoid = char:WaitForChild("Humanoid")
	
	-- Get the feet, so we can add particles to them.
	local leftFoot --= char:WaitForChild("LeftFoot")
	local rightFoot --= char:WaitForChild("RightFoot")
	
	-- Check if the character is R6 or R15
	if (humanoid.RigType == Enum.HumanoidRigType.R6) then
		leftFoot = char:WaitForChild("Left Leg")
		rightFoot = char:WaitForChild("Right Leg")
	elseif (humanoid.RigType == Enum.HumanoidRigType.R15) then
		leftFoot = char:WaitForChild("LeftFoot")
		rightFoot = char:WaitForChild("RightFoot")
	end
	
	-- Create the initial ParticleEmitter. You might want to tweak the rate, speed, etc.
	local particle = Instance.new("ParticleEmitter")
	particle.Texture = "rbxassetid://242008870"  -- Asset URI of the particle.  I just used a toolbox one here.
	particle.Rate = 7
	particle.EmissionDirection = Enum.NormalId.Bottom
	particle.Speed = NumberRange.new(2)
	particle.Lifetime = NumberRange.new(.5)
	
	-- Whether or not a ParticleEmitter already exists in the feet, so we don't accidentally make 2.
	local spawned = false
	
	local pClone = particle:Clone()
	pClone.Parent = leftFoot
	local rpClone = particle:Clone()
	rpClone.Parent = rightFoot
	
	pClone.Enabled = false
	rpClone.Enabled = false
	
	-- Keep checking whether or not the player is moving.
	while true do
		local val = humanoid.MoveDirection
		
		if ((humanoid.FloorMaterial ~= Enum.Material.Air) and (val.X ~= 0 or val.Y ~= 0 or val.Z ~= 0)) then
			if (spawned == false) then
				-- Set spawned to true, so we know the ParticleEmitters are enabled
				spawned = true
				
				-- Enabled the ParticleEmitters.
				pClone.Enabled = true
				rpClone.Enabled = true
			end
		else
			if (spawned) then
				-- Set spawned to so we know that they are disabled.
				spawned = false
				
				if (pClone ~= nil and rpClone ~= nil) then
					pClone.Enabled = false
					rpClone.Enabled = false
				end
			end
		end
		wait()
	end
end)

I hope this works! :grinning:

I updated this twice to make sure it works with both models.

8 Likes