Dont Show This Again UI not working

Hello Developers!

I’m trying to create a “Don’t Show This Again” button for a GUI that pops up after a player dies.

My problem as of now is the script. (I’m not at all a scripter, as building is my area of expertise)

The script closes the UI, but when I die again, it appears again.
Here it is…

local PlayerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
local ReviveUI = PlayerGui:WaitForChild("ReviveUI")

script.Parent.MouseButton1Click:Connect(function()
    ReviveUI.Enabled = false
end)

For more information:

  • This is a LocalScript that is placed inside a TextButton

Can anyone explain how I may be able to resolve this problem?

1 Like

Guis have a property called “ResetOnSpawn” which makes them reset back to original state after the player dies, to solve this just go to properties and disable it.
image

2 Likes

Since ResetOnSpawn is enabled, a few other things will also need to be changed.

local PlayerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
local ReviveUI = playerGui:WaitForChild("ReviveUI")
local ShowPromptOnDeath = false;

game.Players.LocalPlayer.Character.Humanoid.Died:Connect(function()
    if ShowPromptOnDeath then
        ReviveUI.Enabled = true;
    end
end)
script.Parent.MouseButton1Click:Connect(function()
    ShowPromptOnDeath = false
end)

My goal is to give the players an option to turn off the ReviveUI. Turning ResetOnSpawn off would make it so that the UI only appears once, and never after. I’m trying to create a button that disables the ReviveUI for the player, only after they choose to click the “Don’t show this again” button.

Yep, now I understand what’s your problem, in that case you could use a variable to determine if the player has clicked the button before as Ailore did, just he made a little mistake:

local PlayerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
local ReviveUI = playerGui:WaitForChild("ReviveUI")
local ShowPromptOnDeath = true; -- This needs to be set to true by default

game.Players.LocalPlayer.Character.Humanoid.Died:Connect(function()
    if ShowPromptOnDeath then
        ReviveUI.Enabled = true;
    end
end)
script.Parent.MouseButton1Click:Connect(function()
    ShowPromptOnDeath = false
end)

My new issue is, it seems like after the Enabled property is set to false from clicking the button, upon dying again, the Enabled property for the ReviveUI in PlayerGui is set true again. The properties for the PlayerGui’s don’t seem to carry over after the next death.