So umm I am working on this trivia game and where there is a question and if you get it wrong you go to a disaster but the system that finds the people who get it wrong function Answer:GetPlayers() local plrs = { D = {}; A = {}; } for i,v in pairs(PlayerInfo) do print(i) print(v) if v == true then table.insert(plrs.A,i) else table.insert(plrs.D,i) end end return plrs; end
the script that teleport’s the players
`for i,v in pairs(Round.Answers:GetPlayers()) do
print(i)
for a,b in pairs(v) do
print(a)
print(i)
if i == “D” then
game.Players[b].RespawnLocation = game.Workspace.MainFolder.DSpawns:GetChildren()[math.random(1,#game.Workspace.MainFolder.DSpawns:GetChildren())].SpawnLocation;
–print(b)
game.Players[b]:LoadCharacter()
elseif i == “A” then
game.Players[b].RespawnLocation = game.Workspace.Spawns.SSpawn.SpawnLocation
--print(b)
game.Players[b]:LoadCharacter()
end
end
end`
function Answer:GetPlayers()
local plrs = {D = {}; A = {};}
for i, v in pairs(PlayerInfo) do -- what is PlayerInfo?
print(i, v) -- press them together lol
if v then -- changed
table.insert(plrs.A, i)
else
table.insert(plrs.D, i)
end
end
return plrs
end
B
for i, v in pairs(Round.Answers:GetPlayers()) do -- ???
print(i)
for a, b in pairs(v) do
print(a)
-- no print(i) required, since it's the same
if i == "D" then
game.Players[b].RespawnLocation = game.Workspace.MainFolder.DSpawns:GetChildren()[math.random(game.Workspace.MainFolder.DSpawns:GetChildren())].SpawnLocation -- don't need 1 in math.random(not important)
print(b)
game.Players[b]:LoadCharacter()
elseif i == "A" then
game.Players[b].RespawnLocation = game.Workspace.Spawns.SSpawn.SpawnLocation
game.Players[b]:LoadCharacter()
end
end
end
Target
The i in the if statements should be a.
Examining the code, I’ll be brief.
Current target is aiming at what PlayerInfo is. Unfortunately we cannot identify what the variable contains(assume it’s a table, but what’s the structure like?). Can we have information on what PlayerInfo is and how it is manipulated?