So im making a sticky launcher where you can fire stickies and detonate them all at once.
My problem is the fact that I dont think my i,v in pairs loop is not going through all of the Stickies table, which leads to… image|322x205
not all of them exploding.
I have tried doing an i = 1, #Stickies, 1 do loop and putting in local v = Stickies[1] which did nothing.
I have no idea on how to fix this, I’ve looked for solutions on dev forum already but to no avail.
And here is the section of code that I’m talking about
for i,v in pairs(Stickies) do
local Explosion = Instance.new("Explosion")
Explosion.BlastPressure = 500000
Explosion.BlastRadius = 8
Explosion.Position = v.Position
Explosion.DestroyJointRadiusPercent = 0
Explosion.Parent = workspace
Explosion.Hit:Connect(function(touchpart)
if touchpart.Parent:FindFirstChild("Humanoid") then
touchpart.Parent:FindFirstChild("Humanoid"):TakeDamage(35 / 6)
end
end)
local SoundPart = Instance.new("Part")
SoundPart.Size = Vector3.new(0.01, 0.01, 0.01)
SoundPart.Anchored = true
SoundPart.CanCollide = false
SoundPart.Transparency = 1
SoundPart.Position = v.Position
SoundPart.Parent = workspace
local Sound = explodesounds[math.random(1, #explodesounds)]:Clone()
Sound.Parent = SoundPart
Sound:Play()
game.Debris:AddItem(SoundPart, 7)
print(Stickies)
print(i)
table.remove(Stickies, i)
v:Destroy()
end