local players = game:GetService("Players") function emptyfunc() end script.Parent.Touched:Connect(function(hit) emptyfunc() end) local playersbyteam = {} while true do local touch = script.Parent:GetTouchingParts() for i,v in pairs(touch) do print(i, ":", v) wait(0.5) local player = players:GetPlayerFromCharacter(v.Parent) if player then if playersbyteam[player.Name]==nil then print("Player", player.Name) table.insert(playersbyteam,player.Name) print("PLAYERS TABLE:")print(unpack(playersbyteam)) elseif playersbyteam[player.Name]==true then return end else print("Not a player") end end end
That is where my code is currently. Everything works fine until we get to printing out our table. I asked the code not to print it out if player's name is already in the table, but it still does it anyways. The problem I am trying to overcome here is the the player's name being printed out every 0.5 seconds to no extent or until they walk off;
You have the printing in while true do FIRST without checking if it has been printed already, just swap the order.