I've asked tons of people to get up to this point (most of the answers didn't work)
This is my script now:
print("script started")
local part = script.Parent
local Amount = script.Parent.Parent.Space1.SurfaceGui.Amount
local TPService = game:GetService("TeleportService")
print("locals 1 started")
local PlayerInTable = {}
local PlayersToTeleport = {PlayerInTable}
local player = game.Players.LocalPlayer
Amount.Text = "0/6"
local counter = 0
local debounce = false
print("all locals started")
part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local character = hit.Parent
local players = game.Players:GetPlayerFromCharacter(character)
table.insert(PlayerInTable, players)
print("player is in PlayerTable")
end
if PlayerInTable[player] then
print("player table script running")
counter = counter + 1
Amount.Text = counter.. "/6"
wait(1) --// debounce timeout
debounce[player] = true
print(player.Name.. " is in table")
else
debounce = false
print("player not in table")
end
end)
But here is the problem:
if PlayerInTable[player] then
print("player table script running")
counter = counter + 1
Amount.Text = counter.. "/6"
wait(1) --// debounce timeout
debounce[player] = true
print(player.Name.. " is in table")
else
debounce = false
print("player not in table")
end
end)
but goes right to the else and prints "player not in table" why?
(most people I ask just ignore me and they dont know either soo..)

6 comments
Is this a LocalScript? And if so, what is the LocalScript's parent?
Its not a LocalScript
game.Players.LocalPlayer is a read-only property that is locally set to the player instance of the client. However, the property is set only on the client side. This is because on the server, there will never be a client, and therefore the LocalPlayer property will always be set to nil on the server.
I mean that does make sense
What should I do instead
I suggest using a for i, v in pairs() loop to check if player has been inserted into PlayerInTable.