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
You shouldn't use game.StarterGui
when manipulating GUIs, but instead use game.Players.(player name).PlayerGui
instead, because everything in the StarterGui service is cloned into every player's PlayerGui every time they spawn.