GUI disappearing after set time for ever

Hi everyone I was wondering how I’d make a GUI that shows up for a limited time and never shows up again. Like a start pack after a day or a limited time deal. Also that shows a count down till It’s gone. Thanks so much from John.

2 Likes

I believe the easiest way to do that is to create a ScreenGui/ other gui container, and turn off its ResetOnSpawn property. This should stop any instances inside the gui from regenerating, like frames, scripts, labels, etc, when the character respawns.

Using that info, you can create a button and script it so that it pops up/disappears like it usually should in a normal gui container.

1 Like

You could try a script with a GUI in it put into playerscripts.
playerscripts start only once when a player joins,

Gui = script.StarterPackPopup

Events.IsNewPlayer.OnClientEvent:connect(function()
    Gui.Parent = game.Players.LocalPlayer.PlayerGui
end)

Events being just anywhere you’d put your server/client events.

you could use os.Time() to check how long it should be available.

NewUntil = os.time() + 300 --5 minutes later
while os.time() < NewUntil do wait(1) end
Gui:Destroy()

this won’t stop an exploiter from just moving the gui into PlayerGui, but if an exploiter really wanted to buy it, they’d just prompt the purchase for themselves.

I choose to manually check time left every second because how i use it in my game is NewUntil is set by the server. so if a player has poor connection and rejoins they can still be considered “new”
or alternatively have different actions revoke a player’s “newness”, such as buying their first unlockable, or making a different purchase.

4 Likes