How should I get the Players ledaerstats and what am i doing wrong?
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?
01 | marketPlace = game:GetService( "MarketplaceService" ) |
02 | productId = 1156445116 |
03 | playerService = game:GetService( "Players" ) |
04 | local RS = game:GetService( "ReplicatedStorage" ) |
05 | Sword = RS:WaitForChild( "Sword" ) |
06 | local function processRecipt(ReciptInfo) |
07 | local player = playerService:GetPlayerByUserId(ReciptInfo.PlayerId) |
09 | return Enum.ProductPurchaseDecision.NotProcessedYet |
12 | local char = game.Workspace:FindFirstChild(player.Name) |
13 | local swordClone = Sword:Clone() |
14 | swordClone.Parent = char |
15 | player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 5555555555 |
18 | return Enum.ProductPurchaseDecision.PurchaseGranted |
21 | marketPlace.ProcessReceipt = processRecipt |