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

How to put particle in all body?

~ I want the particle to go to the head, torso, arms, legs, every part of the body, and then to disappear.

event.OnServerEvent:Connect(function(player)
local CloneP        = game.ReplicatedStorage.Particles.ParticleEmitter
local character  = player.Character

for i,v in pairs(character:GetChildren()) do
	if v:IsA("Part") or v:IsA("MeshPart") then

		local Particle    = CloneP:Clone()
		Logia.Parent = v
						game.Debris:AddItem(Particle, 1.5)

	     end
       end
end)

3 comments

0

I don't know what you mean. Can you elaborate on what you're trying to do here?

0

I want to put a particle in each body part. HumanoidRootPart, Head etc, everything in character.

0

Without having to put one in one .-- Particle.Parent = Head --Particle.Parent = Torso --understand?

1 answer

✓ Accepted answer
-- ParticleEmitter Doesn't need to be indexed everytime the Event is called, keep it outside of the event scope
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local ParticlesFolder = ReplicatedStorage:WaitForChild("Particles")
local ParticleEmitter = ParticlesFolder:WaitForChild("ParticleEmitter")
local event --= event here

event.OnServerEvent:Connect(function(player)
	local character  = player.Character
	if character then 
		-- You don't have to have the humanoid part
		local humanoid = character:FindFirstChild("Humanoid")
		if humanoid and humanoid.Health > 0 then 
			for _, Child in pairs(character:GetChildren()) do
				if Child:IsA("BasePart") or Child:IsA("MeshPart") then
					local ClonedParticle = ParticleEmitter:Clone()
					-- Child falls within the parameters
						-- Parent ClonedParticle to Child
					ClonedParticle.Parent = Child
					game.Debris:AddItem(ClonedParticle, 1.5)
				end
			end
		end
	end
end)

1 comment

0

This system of verifying the character already has in LocalScript, I will test.

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