Hi there. So I'm wondering why I cannot print a variable after it has been in a repeat loop. Take a look at this script here:
wait(20)
local playerlogger = {}
for i, player in pairs(game.Players:GetPlayers()) do
table.insert(playerlogger, player.Name)
print(table.concat(playerlogger, " "))
end
local playerPicker1 = math.random(1,#game.Players:GetPlayers())
local playerPicker2 = math.random(1,#game.Players:GetPlayers())
print(playerlogger[playerPicker1])
print(playerlogger[playerPicker2])
if playerPicker1 ~= playerPicker2 then
print("player 1 is not player 2")
else repeat local playerPickerNewSelection = math.random(1,#game.Players:GetPlayers()) until playerPickerNewSelection ~= playerPicker2
print(playerlogger[playerPickerNewSelection])
print("player 1 is not player 2(after new selection")
end
Basically, it will get 2 random players from the playerlogger table (playerPicker1 and playerPicker2) and check if the two picked players are the same player. If it is, then it will keep making a new variable (playerPickerNewSelection) until this new variable isn't an already selected player. The problem is that I can't seem to print(playerlogger[playerPickerNewSelection]), which I would need to print in order to see if the new selected player isn't the same one.
I would appreciate any help I receive, and thank you for reading this question.

1 comment
I'm looking into it give me a few mins