Hello. Here is my script for making a ScreenGui TextLabel visible, then invisible. The script makes the Gui visible but doesn't turn it invisible. What is wrong with the script?
Thanks! EDIT: Here is the entire script, to make sure that I am not doing anything else incorrectly that is messing with the GUI
if game.Players.NumPlayers >= 2 then
playgame()
else
moreplayers()
end
function playgame()
print("playgame")
game.Players.PlayerGui.ScreenGui.moreplayers.Visible=false
local beginning = game.Players.PlayerGui.ScreenGui.beginning
beginning.Visible=true
wait(5)
beginning.Visible=false
local modelOfBricks = game.Workspace.spawnwalls
local nameOfBricks = "spawnwall"
for i,v in pairs(modelOfBricks:GetChildren()) do
if v.Name == nameOfBricks then
v.Transparency = 1
v.CanCollide=false
end
end
local go = game.Players.PlayerGui.ScreenGui.go
go.Visible=true
wait(4)
go.Visible=false
wait(10) --END OF ROUND
local roundend = game.Players.PlayerGui.ScreenGui.roundend
roundend.Visible=true
wait(4)
roundend.Visible=false
for i, player in ipairs(game.Players:GetPlayers()) do
if player.Character then
local hum = player.Character:FindFirstChild('Humanoid')
if hum then
hum.Health = 0
end
end
end
modelOfBricks = game.Workspace.spawnwalls
nameOfBricks = "spawnwall"
for i,v in pairs(modelOfBricks:GetChildren()) do
if v.Name == nameOfBricks then
v.Transparency = 0
v.CanCollide=true
end
end
function moreplayers()
print("moreplayers")
game.Players.PlayerGui.ScreenGui.moreplayers.Visible=true
end

6 comments
I changed it to game.Players.PlayerGui, but nothing happened still. Hold on, that's not the whole script.
Still, you need to use the PlayerGui instead of the StarterGui, because the PlayerGui is actually where the GUIs can change. If you change something in the StarterGui, that change will only be seen after the player spawns again.
Yeah, I understand that now. I added the entire script to make sure that nothing was interfering with the GUI
You forgot to put the player name in between "game.Players." and ".PlayerGui" If you mean all the players in the game, then you'll have to use "game.Players:GetPlayers()" and run a generic for loop with that. (For help, look up "GetPlayers" on the Wiki)
The wiki page did not help me.. could you give me an example of using GetPlayers in this code?
Honestly, you should provide code with your answer.. because just explaining it through words obviously confused them.