I’m working on an older version of Roblox, messing around with it. (2007 client, to be exact.) An issue I ran into is that when the game is ran on a server, everything will duplicate per client, so if there’s 1 person, there’s 1 duplicate of everything in the game, leading to immense lag, and tons of bugs (I have no clue why it does this.) Starting with the teams:
local teams = game.Teams:GetChildren()
local save
local destroy
local debounce = false
local counter = 1
local function destroyDuplicate()
while counter < 6 do
for i, team in pairs(teams) do
if string.match(team.Name, counter) and debounce == false then
save = team
debounce = true
elseif string.match(team.Name, counter) and debounce == true then
destroy = team
if save ~= destroy then
destroy:Remove()
end
debounce = false
counter = counter + 1
save = nil
destroy = nil
end
end
end
counter = 1
end
destroyDuplicate()
game.Teams.ChildAdded:connect(destroyDuplicate)
This code only deletes 1 duplicate. It does not delete multiple, and also when a new duplicate is made mid game, it doesn’t delete either.
Havoc Crenshaw is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.