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

Why is the particles only cloning to the lower torso? Any help?

Asked by 5 years ago
Edited 5 years ago

The particles are only cloning to the lower torso, but I want it to go to all the other mesh parts. Any help?

01local Part = script.Parent
02local Debounce = true
03 
04Part.Touched:Connect(function(player)
05    if Debounce == true then
06    local Character = player.Parent
07    local RightUpperLeg = Character:WaitForChild("RightUpperLeg")
08    local RightLowerLeg = Character:WaitForChild("RightLowerLeg")
09    local RightFoot = Character:WaitForChild("RightFoot")
10    local Poison1 = game.Workspace.Poison.PoisonSparkles:Clone()
11    local Poison2 =game.Workspace.Poison.Poison:Clone()
12 
13    for i,v in pairs(Character:GetChildren()) do
14        if v:IsA("MeshPart") then
15            Poison1.Parent = v
View all 21 lines...

1 answer

Log in to vote
0
Answered by
mc3334 649 Moderation Voter
5 years ago

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)

01local Part = script.Parent
02local Debounce = true
03 
04Part.Touched:Connect(function(player)
05    if Debounce == true then
06    local Character = player.Parent
07    local RightUpperLeg = Character:WaitForChild("RightUpperLeg")
08    local RightLowerLeg = Character:WaitForChild("RightLowerLeg")
09    local RightFoot = Character:WaitForChild("RightFoot")
10    local Poison1 = game.Workspace.Poison.PoisonSparkles
11    local Poison2 =game.Workspace.Poison.Poison
12 
13    for i,v in pairs(Character:GetChildren()) do
14        if v:IsA("MeshPart") then
15            Poison1:Clone().Parent = v
View all 21 lines...

or this: (What you were thinking of)

01local Part = script.Parent
02local Debounce = true
03 
04function P1()
05    return game.Workspace.Poison.PoisonSparkles:Clone()
06end
07function P2()
08    return game.Workspace.Poison.Poison:Clone()
09end
10 
11Part.Touched:Connect(function(player)
12    if Debounce == true then
13    local Character = player.Parent
14    local RightUpperLeg = Character:WaitForChild("RightUpperLeg")
15    local RightLowerLeg = Character:WaitForChild("RightLowerLeg")
View all 26 lines...

I hope I was able to help. With further questions/comments/concerns, feel free to reply to my answer. Happy scripting! ~mc3334

0
Thank you so much! Definitely will remember this next time; I really learned from this. :) Microsoft_Net 21 — 5y
0
No Problem! mc3334 649 — 5y
Ad

Answer this question