Hi guys! This is a minigame script that one player types in a question, and four answers and the correct answer. The script then copies those textbox values to stringvalues. The questions and answers are shown to all players and they have to go to the coloured brick they think is right and they get points if they do so.
However, it is not picking a player (It picks random players, like 20 times) and also, this line
for i, v in pairs(game.Players:GetPlayers()) do v.PlayerGui.AnnouncingGui.Announcer.Text = "Intermission!" end
is not displaying the gui :( Any ideas? Thanks
function chooseplayer()
list = {}
for i,v in pairs (game.Players:GetPlayers()) do
table.insert(list,v)
end
num1 = math.random(1,#list) --Number
num1 = list[num1] -- Value from the table
print(num1)
num1.PlayerGui.LeaderGui.SelectedColour.Visible = true
num1.PlayerGui.LeaderGui.TextLabelOne.Visible = true
num1.PlayerGui.LeaderGui.TextLabelTwo.Visible = true
num1.PlayerGui.LeaderGui.TextLabelThree.Visible = true
num1.PlayerGui.LeaderGui.TextLabelFour.Visible = true
num1.PlayerGui.LeaderGui.TextLabelFive.Visible = true
num1.PlayerGui.LeaderGui.TextLabelSix.Visible = true
num1.PlayerGui.LeaderGui.Done.Visible = true
for i, v in pairs(game.Players:GetPlayers()) do
v.PlayerGui.QuestionsGui.Question.Visible = true
v.PlayerGui.QuestionsGui.One.Visible = true
v.PlayerGui.QuestionsGui.Two.Visible = true
v.PlayerGui.QuestionsGui.Three.Visible = true
v.PlayerGui.QuestionsGui.Four.Visible = true
end
for i = 1, #list do
table.remove(list, i)
end
end
while true do
if game.Players.NumPlayers > 1 then
chooseplayer()
else
print("Error. Not enough players")
game.Workspace.Red.Value = ""
game.Workspace.Green.Value = ""
game.Workspace.Yellow.Value = ""
game.Workspace.Blue.Value = ""
game.Workspace.CorrectColour.Value = ""
game.Workspace.Question.Value = ""
for i, v in pairs(game.Players:GetPlayers()) do
v.PlayerGui.AnnouncingGui.Announcer.Text = "Intermission!"
end
wait(5)
for i, v in pairs(game.Players:GetPlayers()) do
v.PlayerGui.AnnouncingGui.Announcer.Text = ""
end
for i, v in pairs(game.Players:GetChildren()) do
v.PlayerGui.QuestionsGui.One.Visible = false
v.PlayerGui.QuestionsGui.Two.Visible = false
v.PlayerGui.QuestionsGui.Three.Visible = false
v.PlayerGui.QuestionsGui.Four.Visible = false
end
end
end

2 comments
"it is not working" is the vaguest thing you can say about a script. At what point is something not happening that you expected to happen? Tell us what is shown in the Output window as well, since you have some print statements in your code. To see Output in online mode, press F9 and then click on Server Console.
My apologies! I thought I posted what was wrong! facepalm