So I am making a minigame and I was just making it so the textlabel would say all the stuff like etc... I testing it many times in studio mode and it worked then i tested it in the actual game and it didn't work can anyone help me with this?
Repstore = game.ReplicatedStorage
maps = Repstore.Maps:GetChildren()
while true do
if game.Players.NumPlayers > 1 then
for i, v in pairs(game.Players:GetChildren()) do
pgui = v:WaitForChild("PlayerGui")
pgui:WaitForChild("MainText").TextLabel.Text = "Not enough players to start!"
end
else
for i, v in pairs(game.Players:GetChildren()) do
pgui1 = v:WaitForChild("PlayerGui")
pgui1:WaitForChild("MainText").TextLabel.Text = "Chosing map"
wait(3)
ranGame = math.random(1, #maps)
gameChosen = maps[ranGame]
for i, v in pairs(game.Players:GetChildren()) do
pgui2 = v:WaitForChild("PlayerGui")
pgui2:WaitForChild("MainText").TextLabel.Text = "Map chosen: ".. gameChosen.Name
wait(3)
gameChosenClone = gameChosen:Clone()
gameChosenClone.Parent = game.Workspace.MapSelected
wait(3)
spawns = gameChosenClone.Spawns:GetChildren()
for i,v in pairs(game.Players:GetPlayers())do
name = v.Name
check = game.Workspace:FindFirstChild(name)
if check then
checkHumanoid = check:FindFirstChild("Humanoid")
if checkHumanoid then
check:MoveTo(spawns[i].Position)
end
end
end
end
end
for i, v in pairs(game.Players:GetChildren()) do
for i = 3, 1, 1 do
pgui3 = v:WaitForChild("PlayerGui")
pgui3:WaitForChild("MainText").TextLabel.Text = "Game begins in".. i
wait(1)
end
for i, v in pairs(game.Players:GetChildren()) do
for i = 10,1, -1 do
pgui4 = v:WaitForChild("PlayerGui")
pgui4:WaitForChild("MainText").TextLabel.Text = "Time left ".. i
wait(1)
end
end
end
for i, v in pairs(game.Players:GetChildren()) do
pgui5 = v:WaitForChild("PlayerGui")
pgui5:WaitForChild("MainText").TextLabel.Text = "Game ended"
wait(3)
gameChosenClone:Destroy()
for i, v in pairs(game.Players:GetChildren()) do
for i = 60,1,-1 do
pgui6 = v:WaitForChild("PlayerGui")
pgui6:WaitForChild("MainText").TextLabel.Text = "Intermission ".. i
end
end
end
end
wait(1)
end

1 comment
You cannot access the PlayerGui from the server.