One time Showing Gui

I want to make a script where, a certain gui canonly be shown ONCE.

As in, if you rejoin, it wont show again. The gui Pops up from a Hit function.

But I just dont know how to do this exactly as I am not experienced with datastores.

Obviously It should be Client Based and Not Server Sided

Can anybody help me with this?

thanks for your time.

2 Likes

Tried instancing a value put in the local player, but datastoring it seems to fail.

so id like to know the proper way

1 Like

I mean, you could take advantage of the free badges?

Create a badge that you award once the menu shows up. Then, on all future attempts, check if the player has the badge. If not, show the GUI

2 Likes

UserHasBadge does not work for client

Only server

1 Like

Then you could put the thing in a Server Script (that is in ServerScriptService), then, if the player doesn’t have the badge, clone a gui and put it into their player gui

2 Likes

Then that will affect all players in the game, and not just the one who has the badge.

1 Like

No it won’t

Put it in the playerAdded() function

PlayerGui is only for a single player

2 Likes

Are you opposed to using DataStores and RemoteEvents / RemoteFunctions? If so, why?

Badges are one way to do this without datastores, but keep in mind players do have full authority to delete badges they have in the inventory (although, I’m unsure that anyone has a reason to do this)

If you really don’t want to use DataStores, you can use badges for sure. Other than that and over complicating it with an external database, I don’t think there really is another way.

1 Like

Ill try, but I need a better way to test this without using another account

1 Like

There is no way to do that client sided, you have to do that with the server. You could do that(VERY simple way to do it):

1:


Enable DSS access

2:
image
Add a script to the UI - NO LOCAL SCRIPT

3: Paste that code

local DSS = game:GetService("DataStoreService") -- Get the DataStoreService
local DS = DSS:GetDataStore("UiStore", script.Parent.Name) -- Get the data store
script.Parent.Enabled = false
local player = script.Parent.Parent.Parent -- Get the player where the UI is attached to: (Player)->PlayerGui->UI
local success, currentValue = pcall(function() -- Do a pcall(protected call) to get the data cuz datastores can return in an error
	return DS:GetAsync(player.UserId) -- Return the saved data
end)
if currentValue == nil then -- Check if data is empty
	script.Parent.Enabled = true -- Enable UI
	local success, err = pcall(function() -- Do a pcall(protected call) to load  the data cuz datastores can return in an error
		return DS:SetAsync(player.UserId, true) -- save the data
	end)
	if success then
		-- Runs when user joins first time
	else
		-- Runs when user joins NOT first time
	end
end

-- BY: RATZIFUTZI
-- LICENSE: MIT
-- SATURDAY 2ND APRIL 2022 13:56 UTC (GMT) + 1 hour

Boom, finished

ADDENDUM:
It is not that professional to use server scripts in a UI, but that is the easiest way to do it

2 Likes

As it turns out, you and poppy, are right, poppy with the more simple solution. Though Ill be sure to use that once I need it.

1 Like