Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How should I get the Players ledaerstats and what am i doing wrong?

Asked by 3 years ago

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
0
server script right? jerryisgod29 176 — 3y
0
yea server script bestshot123 38 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

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

Ad

Answer this question