I literally just asked a question but I'm making a game and sadly I keep running into issues.
So this would increase the purchaser's WalkSpeed by 7 once purchased. Here is the total script -
local MartketplaceService = game:GetService('MarketplaceService') local devproductid = 84718040 local devproductid2 = 84717927 local devproductid3 = 84715500 MartketplaceService.ProcessReceipt = function(receiptInfo) for i, player in ipairs(game.Players:GetChildren())do if player.userId == receiptInfo.PlayerId then if receiptInfo.ProductId == devproductid2 then player.leaderstats.Stage.Value = player.leaderstats.Stage.Value + 1 end if receiptInfo.ProductId == devproductid then player.leaderstats.Stage.Value = player.leaderstats.Stage.Value + 3 end if player.leaderstats.Stage.Value > 15 then player.leaderstats.Stage.Value = 15 end if receiptInfo.ProductId == devproductid3 then player:FindFirstChild("Character").Humanoid.WalkSpeed = player:FindFirstChild("Character").Humanoid.WalkSpeed + 7 end end end return Enum.ProductPurchaseDecision.PurchaseGranted end
But this is the part that is not working and causing me problems. The error that is popping up is "Line 18 is indexing a nil value" -
if receiptInfo.ProductId == devproductid3 then player:FindFirstChild("Character").Humanoid.WalkSpeed = player:FindFirstChild("Character").Humanoid.WalkSpeed + 7 end
Remove :FindFirstChild("Character")
It is just player.Character.
So in conclusion, your code code that is indexing nil should be:
if receiptInfo.ProductId == devproductid3 then player.Character.Humanoid.WalkSpeed = player.Character.Humanoid.WalkSpeed + 7 end
Sorry if this isn't well explained, I am in a rush, hope this solved your problem though! :)