How to destroy a GUI permanently

I made a W.I.P. screen and when a player clicks Play it destroys the screen. I want it to be destroyed permanently so it doesn’t come when you die and respawn.

I wrote this tiny piece of code that I figured would destroy it and when something gets destroyed it wouldn’t come back because it simply wasn’t hidden, however being inexperienced obviously that wasn’t the case.

local Button = script.Parent

Button.MouseButton1Click:Connect(function()
	script.Parent.Parent.Parent.Parent:Destroy() --this references the ScreenGui that everything is connected to, therefore destroying everything (I think)
end)

I was thinking I could run a second script that would delete the screen right after you respawn so the player doesn’t see it when they respawn but I’m not sure what event I would use to determine if a player just respawned and I’ve tried looking for it but I couldn’t find anything. I’m not even sure if that would work anyway.

Try disabling the “ResetOnSpawn” option under your ScreenGui, it should work.

1 Like

Player.CharacterAdded is the event you’re looking for.

Press F1 in studio and search for the instance you want the methods for.

Note to self: Check properties noob

Tysm :>