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

Destroy a GUI for good?

Asked by 9 years ago

So I got a choice and you click one of two buttons. I will make them do stuff later on but for now I just want the GUI to destroy for good but when the player dies, it comes back. It's in a local script. I want it to show up when the player enters but once they click the button, it stays gone for that player forever.

local gui = script.Parent.Parent.Parent
local function onClicked()
    gui:destroy()
end


script.Parent.MouseButton1Click:connect(onClicked)

3 answers

Log in to vote
0
Answered by 9 years ago

Put this LOCAL SCRIPT inside of the gui...

local gui = script.Parent.Parent.Parent
local function onClicked()
Instance.new("ObjectValue", game.Players.LocalPlayer).Name = "NoGui"
gui:Destroy()
end


script.Parent.MouseButton1Click:connect(onClicked)

while wait(0) do
    if game.Players.LocalPlayer.NoGui then
       gui:destroy()
    end
end

It will put an object value inside the player which will NEVER disappear even when they reset. This script doesn't affect everyone in the game only the player who clicked the gui. It's gone forever and no one can get it back.


This script will show the gui for a quick glimpse but It gets destroyed directly after.

Ad
Log in to vote
-1
Answered by
Agios 10
9 years ago
local gui = script.Parent.Parent.Parent
local function onClicked()
    gui.Visible = false
end

script.Parent.MouseButtton1Click:connect(onClicked)

0
You need to explain why this would work. If you just slap the code how is he going to know what is going on? EzraNehemiah_TF2 3552 — 9y
Log in to vote
-1
Answered by 9 years ago

Try using Remove, but what you have should work...unless you are trying to remove it from ALL players then that script is a little more complicated. If you are trying to connect this to when your player dies, it needs to remove it from the local StarterPlayer, other than that it will always come back if its in StarterPack.

0
No it is supposed to show up when the player enters the server. Then once they click it it disappears and stays gone. But it shows up once the player dies again and I don't want that. CrispyBrix 113 — 9y
0
then you need a local script in StaterGui saying "onplayerentered" or whatever, then gui:clone().parent = "newpalyer" or however you word it, and of course there are other steps but im sure you understand :D BSIncorporated 640 — 9y

Answer this question