The issue is that every other input other than the first one just transforms after few seconds to the first one, str.Value not increasing correct and isn’t saved in roblox datastore
game.Players.PlayerAdded:Connect(function(plr)
local str = Instance.new("IntValue")
str.Parent = plr
local DBR = game:GetService("DataStoreService"):GetDataStore("BBC")
local RBM = require(game:GetService("ReplicatedStorage"):WaitForChild("RobaseService"))
local RobaseService = RBM.new("DELETED")
local defaultRobase = RobaseService:GetRobase()
local success, SGameIds = defaultRobase:GetAsync("GameIds")
local mkp = game:GetService("MarketplaceService")
game.ReplicatedStorage.BAD.OnServerEvent:Connect(function(plr,GameId)
mkp.PromptProductPurchaseFinished:Connect(function(userId,product,purchased)
if purchased then
str.Value = str.Value+1
local success, err = pcall(function()
DBR:SetAsync(plr.UserId,str.Value)
end)
defaultRobase:SetAsync("GameId"..plr.UserId.." - "..str.Value,GameId, "PUT")
end
end)
end)
end)