Hi guys I wanted to make a player count system so when the player count is at 3 a script is being disabled but apparently it is not working I tried using the .disabled = true but it is still not working
here is a link of the video showing the problem
local tp = script.Parent
local playercount = {}
local tpsystem = workspace.tp.Script1
tp.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if not table.insert(playercount, hit.Parent) then
print(playercount)
if #playercount < 1 then
tpsystem.Disabled = true
end
--table.insert(playercount, hit.Parent)
--print("2")
end
end
end)
tp.TouchEnded:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if table.find(playercount, hit.Parent) then
table.remove(table,-1)
end
end
end)
full script there