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

Is it possible to completely remove something from the PlayerGui?

I have a surface gui with an adornee of a brick in the workspace. I want to get rid of it using a script that channels through the playergui and deletes it in there. I do that and it gets rid of it, but when the player resets it comes back, and it will come back no matter what i try. Is getting rid of it even possible?

I have asked this before but I actually haven't found a solution yet.

If there was a OnSpawn or OnReset event or function or whatever, I could use that. But I don't know what I could use

4 comments

0

Sorry about that, I tried

0

surfacegui:Destroy()??

0

it comes back

0

its in playergui

1 answer

Hello, Red_Musician!

If I understood well, you want to remove a component with scripts, right?

Thats easy:

--Lets create a part just to have something to remove...
Instance.New("Part").Parent = game.Workspace

--Now lets destroy it

game.Workspace.Part:Destroy() -- game.Workspace.Part = Find the part with scripts :Destroy() = Remove the part

The ":Destroy()" method can be used to destroy anything... A player, a part(same as the example), A Gui...

If you want to disable a GUI when the player die and it don't apear anymore just disable "Reset on spawn" on the GUI

Good luck with your games!

3 comments

0

Yes, I understand how to remove instances from anything, but this is different. I have already removed it with :Destroy(), but it returns as if nothing had happened when the player resets. I am wondering if you can keep it destroyed. If you want to know what im talking about, try it yourself

1

If you want to disable a GUI when the player die and it don't apear anymore just disable "Reset on spawn" on the GUI

0

Im using a surface gui

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