Please do not ask people to write entire scripts or design entire systems for you. If you can't answer the three questions above, you should probably pick a different category.
Please Stop, i am willing to help but please follow the rules
Here is a script that someone made a while ago: (Credit: Kaid3n22)
local DataStore = game:GetService("DataStoreService") -- Data Store Service
local DS = DataStore:GetDataStore("Data") -- Creates a DataStore
local Players = game:GetService("Players")
local PGP = {} -- Purchased Game passes
Players.PlayerAdded:Connect(function(plr)
local Data = DS:GetAsync(plr.UserId, PGP[plr.UserId]) or {}
end)
Players.PlayerRemoving:Connect(function(plr)
DS:SetAsync(plr.UserId, PGP[plr.UserId])
PGP[plr.UserId] = nil
end)
I dont believe you can, you might be able to do this:
game.ReplicatedStorage.Event.OnServerEvent:Connect(function(plr, GamepassId)
if not table.find(PGP[plr.UserId], GamepassId) then
-- if the Player doesnt own the Item
table.insert(PGP[plr.UserId], GamepassId)
else
-- If the Player already owns the item and is inside the table
end
end)
Here, let’s do a stringvalue instead. I know you can save stringvalues.
Also these wont be gamepasses, they’ll be ingame things you can buy with ingame cash
It’s really bad to do it like that, exploiter can put any gamepass id in there, like if he has other gamepass that gives another benefits but it will trigger since player has it. It’s better to have id variable on the server instead of client and then check if the player has it