Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My GUI is not being turned off, what am I doinf wrong?

For some reason, the GUI is turned on at the end of the while true do loop (which is what needs to happen). However, the results gui doesn't get turned off when the loop restarts.

Here is the code:


while true do
	game.StarterGui.Results.Enabled = false -- turns off the results gui 
	for i = 1,10 do 
		GameStatus.Value = "Intermisson "..10-i 
		
		wait(1)
	end



---- my game's main code is here ----



	game.StarterGui.Results.Enabled = true --- turns on the results gui
	
	for i = 1,#players do
		if players[i].Character ~= nil then
			players[i]:LoadCharacter()

		end
	end
	
	
	wait(3)
	map:Destroy()
	
end

1 answer

✓ Accepted answer

you are attempting to turn the gui off from startergui, this will only turn off the gui that players start with when they join or reset, you need to turn the gui off inside the players PlayerGui

inside your code you could fire all the clients in the game with this:

game.ReplicatedStorage:FireAllClients()

and inside a localscript you put inside the gui you could put:

game.ReplicatedStorage.OnClientEvent:Connect(function()
	script.Parent.Enable = false
end)

i know this answer is not the best answer but if it did help be sure to mark it as answer and as always leave a reply if you have any problems.

This discussion is preserved as it was. New answers, comments, and votes are closed.