Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago

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

Log in to vote
1
Answered by
TickoGrey 116
3 years ago

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.

Ad

Answer this question