I have a script that if you buy the developer product (prompt by the button) then it'll TP your character to a certain position in the map
but when I click the button the purchase gui doesn't come up it gives me an error saying
datastore isn't accessible from the client???
Here's my script
script.Parent.MouseEnter:connect(function(Enter)
script.Parent.Style = "RobloxButtonDefault"
script.Parent.Size = UDim2.new(0, 215, 0, 55)
end)
script.Parent.MouseLeave:connect(function(Leave)
script.Parent.Style = "RobloxButton"
script.Parent.Size = UDim2.new(0, 200, 0, 50)
end)
local MarketplaceService = game:GetService("MarketplaceService")
local ID = 22158084
local PurchaseHistory = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory") -- error is most likely in this line of code
MarketplaceService.ProcessReceipt = function(receiptInfo)
for i, player in ipairs(game.Players:GetChildren()) do
if player.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == ID then
player.Character.Torso.CFrame = CFrame.new(-8, 34.5, -52)
end
end
end
local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.PurchaseId
PurchaseHistory:IncrementAsync(playerProductKey, 1)
return Enum.ProductPurchaseDecision.PurchaseGranted
end

1 comment
OH okay thanks