Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

'DataStoreSerivce' is not a valid Service name

When I do the first line of the script calls it does the following error:

21:47:02.705 - 'DataStoreSerivce' is not a valid Service name 21:47:02.706 - Script 'ServerScriptService.Script', Line 2 21:47:02.708 - stack end

The script:

local MarketplaceService = game:GetService("MarketplaceService")
local ds = game:GetService("DataStoreSerivce"):GetDataStore("PvPPurchaseHistory")
 
MarketplaceService.ProcessReceipt = function(receiptInfo) 
    -- find the player based on the PlayerId in receiptInfo
    for i, player in ipairs(game.Players:GetChildren()) do
        if player.userId == receiptInfo.PlayerId then
            -- check which product was purchased (required, otherwise you'll award the wrong items if you're using more than one developer product)
            if(tonumber(receiptInfo.ProductId) == 19304410)then
				--TODO: Buy the Ocherous Katana of the Setting Sun
				game.InsertService:LoadAsset(25545089).OrangeKatana.Parent = player.Backpack
				game.InsertService:LoadAsset(25545089).OrangeKatana.Parent = player.StarterGear
			end
        end	
    end
    -- record the transaction in a Data Store
    local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.PurchaseId
   	ds:IncrementAsync(playerProductKey, 1)	
    -- tell ROBLOX that we have successfully handled the transaction (required)
    return Enum.ProductPurchaseDecision.PurchaseGranted		
end

1 answer

✓ Accepted answer

It is spelled "DataStoreService" not "DataStoreSerivce"

1 comment

0

Darn my spelling. Thanks

This discussion is preserved as it was. New answers, comments, and votes are closed.