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

Team change GUI not being removed???

function Click(mouse) 
	while wait() do
	game.Players.LocalPlayer.PlayerGui.CTGUI:Remove()
	end
end 

script.Parent.MouseButton1Click:connect(Click) 

This removes the GUI from the player GUI after he clicks a team but it only removes it the first time then he respawns and it is there again.

1 answer

It seems you are a beginner, so let's do this slowly.

First thing (not necessarily part of the answer): the :Remove() method is deprecated, use :Destroy() instead.

Ok, now the answer.

Probably (since you didn't give details) that CTGUI is inside StarterGui. The StarterGui is where everything in the screen will be loaded when the player respawns, so that CTGUI can't be placed there, you need to place it directly to the PlayerGui.

Also, that while wait() domakes absolutely no sense there. It is a infinite loop in the middle of a function that will be used only once, so you can discard it.

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