Gui not deleting

Hey, if your code dosen’t work, Roblox is currently down. But if you need more help and it dosen’t work, I can help a little.

2 Likes

Ok i just made it work. Now theres just one last thing that doesnt work. I wrote that theres a gui that appear, but it doesnt appear for a weird reason.


local StarterGui = game:GetService("StarterGui")
local CountdownGui = StarterGui.CountdownGui
local CountdownPlrGui = game.Players.LocalPlayer.PlayerGui.CountdownGui

local time = 30  
for i = 1, 30 do
	wait(1) 
	time = time - 1 
	script.Parent.Text = "Match starting in: "..tostring(time) 

end 

script.Parent.Text = "Starting Match..."
wait(1)

script.Parent.Text = "Choosing Teams..."
game.ReplicatedStorage.StartTeamChoosing:FireServer()
--game.ServerScriptService.TeamChoosing.Enabled = true
game.StarterGui.Teams.Enabled = true -- THIS PART DOESNT APPEAR/WORK
wait(0.5)

CountdownGui:Destroy()
CountdownPlrGui:Destroy()
print("CountdownGui deleted from StarterGui")
1 Like

Its because once again, you are trying to do things with objects in StarterGui.
You need to find that in the PlayerGui

1 Like

one rule of thumb is anything in : StarterPack,StarterGui,StarterPlayer will be cloned and put inside the player whenever a new player joins so never try to reference Starter… in your scripts

2 Likes

i get this error now : Teams is not a valid member of PlayerGui “Players.dav2777.PlayerGui” - Client - LocalScript:4

Is it because the gui is not enabled?

local StarterGui = game:GetService("StarterGui")
local CountdownGui = StarterGui.CountdownGui
local CountdownPlrGui = game.Players.LocalPlayer.PlayerGui.CountdownGui
local TeamsPlrGui = game.Players.LocalPlayer.PlayerGui.Teams

local time = 30  
for i = 1, 30 do
	wait(1) 
	time = time - 1 
	script.Parent.Text = "Match starting in: "..tostring(time) 

end 

script.Parent.Text = "Starting Match..."
wait(1)

script.Parent.Text = "Choosing Teams..."
game.ReplicatedStorage.StartTeamChoosing:FireServer()
TeamsPlrGui.Enabled = true
wait(0.5)

CountdownGui:Destroy()
CountdownPlrGui:Destroy()
print("CountdownGui deleted from StarterGui")

Try
local TeamsPlrGui = game.Players.LocalPlayer.PlayerGui:WaitForChild(“Teams”)

2 Likes

It works thank you so much for your help. :smile:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.