bin = script.Parent TeamColor = script.Parent.TeamColor.Value function getWeapons() print("Get Weapons") local children = bin:getChildren() local weapon = {} for i=1,#children do if (children[i].className == "Tool" or children[i].className == "HopperBin") then table.insert(weapon, children[i]:clone()) children[i]:remove() end end for i=1,#weapon do print(weapon[i].Name) end return weapon end function getCharacter(Player) return game.Workspace:findFirstChild(Player.Name) end function getPlayer(Character) return game.Players:findFirstChild(Character.Name) end weapons = getWeapons() function NewObject(object) if (object:findFirstChild("Humanoid") ~= nil) then print("New Humanoid") if (getPlayer(object) ~= nil) then print("Player Respawned") if (getPlayer(object).TeamColor == TeamColor) then for i=1,#weapons do local w = weapons[i]:clone() w.Parent = getPlayer(object).Backpack end end end end end game.Workspace.ChildAdded:connect(NewObject)
why in server it gives me two same weapons instead of one for example i put a tool into the starterpack and when i run the game my character will get 2 same tools what is wrong???