✓ Accepted answer
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
2 comments
Thank you so much! Definitely will remember this next time; I really learned from this. :)
No Problem!