local plr = game.Players.LocalPlayer
local rep = game.ReplicatedStorage
events = {}

script.Parent:WaitForChild("start").MouseButton1Click:Connect(function()
script.Parent.nums.Visible = true
for i,v in pairs(script.Parent.nums:GetChildren()) do
local first = v.MouseButton1Click:Connect(function()
for i,e in pairs (events) do
e:Disconnect()
e = nil
end
print(#events)
end)
table.insert(events,first)
end
print(#events)
end)

Basically i put the event's in a table then i scan through the whole table and try to disconnect them all but when i print #events after i disconnected them AND made them nil it still says 6 event's??

2 comments

1

They are disconnecting. You just still have a reference to the variables in memory (because of the table). Set the values in the table to nil.

0