Is there a way to save scripts that a player has bought. (This may sound weird but im about to explain it). In my game the things you can purchase are abilities. Instead of the abilties being tools they are local scripts that are activated by pressing the "E" key. Anyway is there a way of transforming this script (which enables you to purchase things with R$) into a script that saves the items a player has purchased in game with leader-board stats such as "cash".
productId = 19372077
local MarketplaceService = Game:GetService("MarketplaceService")
function UsernameFromID(ID)
if type(ID) ~= "number" then
return
end
local sets = game:service("InsertService"):GetUserSets(ID)
for k, v in next, sets do
if v.Name == "My Models" then
return v.CreatorName
end
end
end
function giveRewards(player)
-- do stuff you want to do here, using the variable player for the player that clicked it. To access the character, do player.Character.
return Enum.ProductPurcaseDecision.PurchaseGranted
end
MarketplaceService.ProcessReceipt = function(receiptInfo)
giveRewards(UsernameFromID(receiptInfo.PlayerId))
end
script.Parent.MouseButton1Down:connect(function()
Game:GetService("MarketplaceService"):PromptProductPurchase(script.Parent.Parent.Parent.Parent, productId)
end)
[Im trying to make a cool game but the only thing holding me back from releasing it to the public is data store :(]

2 comments
I was thinking of making a value save, and make the StringValue's Value the Source of the script, I dont know if it would work.
hmm...