I made a script that explodes everyone in a server one at a time, and I had it fire each time you clicked a brick, and it worked when it was in the brick. I thought such a thing would be more fit for a Gui, so I put it in a Gui, changed MouseClick to MouseButton1Clickand then realized it doesn't work. I don't know why D; It puts players in the table just fine but the function just isn't firing. ;c
local Players = {}
game.Players.PlayerAdded:connect(function(Player)
table.insert(Players,Player)
print(Players,Player)
end)
game.Players.PlayerRemoving:connect(function(Player)
table.remove(Players,Player)
end)
function GenocideBomb()
for i, v in pairs (Players) do
local Explode = Instance.new("Explosion")
Explode.BlastRadius = 5
Explode.BlastPressure = 500000
Explode.Position = v.Character.Torso.Position
Explode.Parent = v.Character
wait(1)
end
end
script.Parent.MouseButton1Click:connect(function()
print("Fired")
GenocideBomb()
end) -- https://www.youtube.com/watch?v=4ZCZ1pl37Ag
Oh, also when a player leaves the script doesn't remove the player from the table and says number expected got object-- so itwouldbeniceifyouhelpedmewiththattoo. How would I fix this problem and avoid it in the future?
