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.
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.