Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is my script skipping "if PlayersInTable[player] do"?

Asked by 4 years ago

I've asked tons of people to get up to this point (most of the answers didn't work)

This is my script now:

01print("script started")
02 
03 
04local part = script.Parent
05local Amount = script.Parent.Parent.Space1.SurfaceGui.Amount
06local TPService  = game:GetService("TeleportService")
07print("locals 1 started")
08 
09local PlayerInTable = {}
10 
11local PlayersToTeleport = {PlayerInTable}
12 
13local player = game.Players.LocalPlayer
14 
15Amount.Text = "0/6"
View all 42 lines...

But here is the problem:

01if PlayerInTable[player] then
02        print("player table script running")
03        counter = counter + 1
04        Amount.Text = counter.. "/6"
05        wait(1) --// debounce timeout
06        debounce[player] = true
07        print(player.Name.. " is in table")
08    else
09        debounce = false
10        print("player not in table")
11    end
12     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..)

0
Is this a LocalScript? And if so, what is the LocalScript's parent? deeskaalstickman649 475 — 4y
0
Its not a LocalScript Magicalsuperlily914 15 — 4y
0
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. deeskaalstickman649 475 — 4y
0
I mean that does make sense Magicalsuperlily914 15 — 4y
View all comments (2 more)
0
What should I do instead Magicalsuperlily914 15 — 4y
0
I suggest using a for i, v in pairs() loop to check if player has been inserted into PlayerInTable. deeskaalstickman649 475 — 4y

Answer this question