The particles are only cloning to the lower torso, but I want it to go to all the other mesh parts. Any help?
local Part = script.Parent local Debounce = true Part.Touched:Connect(function(player) if Debounce == true then local Character = player.Parent local RightUpperLeg = Character:WaitForChild("RightUpperLeg") local RightLowerLeg = Character:WaitForChild("RightLowerLeg") local RightFoot = Character:WaitForChild("RightFoot") local Poison1 = game.Workspace.Poison.PoisonSparkles:Clone() local Poison2 =game.Workspace.Poison.Poison:Clone() for i,v in pairs(Character:GetChildren()) do if v:IsA("MeshPart") then Poison1.Parent = v Poison2.Parent = v end end Debounce = false end end)
hi, the reason you have this issue is because the particles are only cloned once. I think what you were thinking of is making a seperate function and returning a new particles every time. To fix your error, do this: (Easiest Way)
local Part = script.Parent local Debounce = true Part.Touched:Connect(function(player) if Debounce == true then local Character = player.Parent local RightUpperLeg = Character:WaitForChild("RightUpperLeg") local RightLowerLeg = Character:WaitForChild("RightLowerLeg") local RightFoot = Character:WaitForChild("RightFoot") local Poison1 = game.Workspace.Poison.PoisonSparkles local Poison2 =game.Workspace.Poison.Poison for i,v in pairs(Character:GetChildren()) do if v:IsA("MeshPart") then Poison1:Clone().Parent = v Poison2:Clone().Parent = v end end Debounce = false end end)
or this: (What you were thinking of)
local Part = script.Parent local Debounce = true function P1() return game.Workspace.Poison.PoisonSparkles:Clone() end function P2() return game.Workspace.Poison.Poison:Clone() end Part.Touched:Connect(function(player) if Debounce == true then local Character = player.Parent local RightUpperLeg = Character:WaitForChild("RightUpperLeg") local RightLowerLeg = Character:WaitForChild("RightLowerLeg") local RightFoot = Character:WaitForChild("RightFoot") for i,v in pairs(Character:GetChildren()) do if v:IsA("MeshPart") then P1().Parent = v P2().Parent = v end end Debounce = false end end)
I hope I was able to help. With further questions/comments/concerns, feel free to reply to my answer. Happy scripting! ~mc3334