So i did a script for a dev product but i want to make sure the players get extra cash too. Im having trouble getting the player instance. Im not getting any error so how can i fix this and add cash to their stats?
marketPlace = game:GetService("MarketplaceService")
productId = 1156445116
playerService = game:GetService("Players")
local RS = game:GetService("ReplicatedStorage")
Sword = RS:WaitForChild("Sword")
local function processRecipt(ReciptInfo)
local player = playerService:GetPlayerByUserId(ReciptInfo.PlayerId)
if not player then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
if player then
local char = game.Workspace:FindFirstChild(player.Name)
local swordClone = Sword:Clone()
swordClone.Parent = char
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 5555555555
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
marketPlace.ProcessReceipt = processRecipt

2 comments
server script right?
yea server script