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

Team change GUI not being removed???

Asked by 9 years ago
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

Log in to vote
2
Answered by
Tesouro 407 Moderation Voter
9 years ago

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.

Ad

Answer this question