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

how do i place a particleemiter on multiple character parts easier?

Hello, i was just wondering if there is an easy way to do this since i would have to do this with every other body part, look at the code and the disabled line to understand, yes i know that the disabled line won't work like i want it to. i just started lua so don't judge me :P

local p1 = game.ServerStorage.Nebulea1

local p2 = game.ServerStorage.Nebulea2

local p3 = game.ServerStorage.Nebulea3

local p4 = game.ServerStorage.Nebulea4

  

game.Players.PlayerAdded:Connect(function(plr)

plr.CharacterAdded:Connect(function(char)

local plrP1 = p1:Clone()

local plrP2 = p2:Clone()

local plrP3 = p3:Clone()

local plrP4 = p4:Clone()

--plrP1.Parent = char.UpperTorso, char.LowerTorso, char.RightLowerArm, char.LeftLowerArm, char.RightLowerLeg, char.LeftLowerLeg

plrP2.Parent = char.UpperTorso

plrP3.Parent = char.UpperTorso

plrP4.Parent = char.UpperTorso

end)

end)

1 comment

0

Loop thorugh the player and clone to the parts that r being looped though using in pairs

1 answer

Make a for loop that loops though the player's meshparts/bodyparts. This should work:

game.Players.PlayerAdded:Connect(function(plr)
 plr.CharacterAdded:Connect(function(chr)
 local p1 = game.ServerStorage:WaitForChild("Nebulea1")
 local p2 = game.ServerStorage:WaitForChild("Nebulea2")
 local p3 = game.ServerStorage:WaitForChild("Nebulea3")
 local p4 = game.ServerStorage:WaitForChild("Nebulea4")
 local Cp1 = p1:Clone()
 local Cp2 = p2:Clone()
 local Cp3 = p3:Clone()
 local Cp4 = p4:Clone()
 Cp2.Parent = chr:WaitForChild("UpperTorso")
 Cp3.Parent = chr.UpperTorso
 Cp4.Parent = chr.UpperTorso
 for i,v in pairs(chr:GetChildren()) do
 if v:IsA("MeshPart") then
 Cp1.Parent = v
 end
 end
 end)
 end)

Hope that works. Good luck with our game.

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