Im using the third gamepass to make money gain more visible, so far it works, but if i rejoin multiple times, i keep earning that money. How can I make the gamepass one time? This is the leaderstats script.
local datastore = game:GetService("DataStoreService") local ds1 = datastore:GetDataStore("officialpointfortlolSaveSystem") local ds2 = datastore:GetDataStore("changetheimagecoinsSaveSystem") local ds3 = datastore:GetDataStore("ctirebirthsSaveSystem") local gamepass_id1 = 18287787 local gamepass_id2 = 18287797 local gamepass_id3 = 18309443 local stat = "Changes" local gamepass_stat1 = 100 local gamepass_stat2 = 1000 local gamepass_stat3 = 10000 game.Players.PlayerAdded:connect(function(plr) local folder = Instance.new("Folder", plr) folder.Name = "leaderstats" local gems = Instance.new("IntValue", folder) gems.Name = "Changes" local coins = Instance.new("IntValue", folder) coins.Name = "Coins" local rebirths = Instance.new("IntValue", folder) rebirths.Name = "Rebirths" gems.Value = ds1:GetAsync(plr.UserId) or 0 ds1:SetAsync(plr.UserId, gems.Value) gems.Changed:connect(function() ds1:SetAsync(plr.UserId, gems.Value) coins.Value = ds2:GetAsync(plr.UserId) or 0 ds2:SetAsync(plr.UserId, coins.Value) coins.Changed:connect(function() ds2:SetAsync(plr.UserId, coins.Value) rebirths.Value = ds3:GetAsync(plr.UserId) or 0 ds3:SetAsync(plr.UserId, rebirths.Value) rebirths.Changed:connect(function() ds3:SetAsync(plr.UserId, rebirths.Value) local award3 = Instance.new("BoolValue", plr) award3.Name = "Award3" if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId, gamepass_id3) and plr.Award3.Value == false then plr.Award3.Value = true gems.Value = gems.Value + gamepass_stat3 end end) end) while wait(3) do for i, v in pairs(game.Players:GetChildren()) do if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(v.UserId, gamepass_id3) and v:WaitForChild("Award3").Value == false then v.Award3.Value = true v.leaderstats:FindFirstChild(stat).Value = v.leaderstats:FindFirstChild(stat).Value + gamepass_stat3 end end end game.ReplicatedStorage.re.OnServerEvent:Connect( function(player) player.leaderstats.Changes.Value += 1 end) end) end)