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