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

Destroy a GUI for good?

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

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.

local gui = script.Parent.Parent.Parent
local function onClicked()
	gui.Visible = false
end

script.Parent.MouseButtton1Click:connect(onClicked)

1 comment

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?

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.

2 comments

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.

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

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