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

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?

 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

0

server script right?

0

yea server script

1 answer

Works fine the script is correct, I had a script that i thought was disabled but wasn't, so it broke this one.

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