I'm wondering another way to access a LocalPlayer through a regular script, How would I go about doing this? I'm wanting to do this so I can add the value when buying developer products.
game.Players.LocalPlayer.MoneyValue
That's what I'm trying to do only through a Script, How would I accomplish this?
Here's the developer product script I'm wanting it to work with
local MarketplaceService = game:GetService("MarketplaceService")
local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
local pid1 = 363906114
local pid2 = 363906921
local pid3 = 365773688
local pid4 = 365773990
local pid5 = 365774250
local pid6 = 365774578
local sid = 364007259 -- StarterPack
local Money = -- However I get to the LocalPlayer --
MarketplaceService.ProcessReceipt = function(receiptInfo)
for i, player in ipairs(game.Players:GetChildren()) do
if player.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == pid1 then
Money.Value = Money.Value + 1000
elseif receiptInfo.ProductId == pid2 then
Money.Value = Money.Value + 5000
elseif receiptInfo.ProductId == sid then
Money.Value = Money.Value + 10750
elseif receiptInfo.ProductId == pid3 then
Money.Value = Money.Value + 10000
elseif receiptInfo.ProductId == pid4 then
Money.Value = Money.Value + 25000
elseif receiptInfo.ProductId == pid5 then
Money.Value = Money.Value + 50000
elseif receiptInfo.ProductId == pid6 then
Money.Value = Money.Value + 100000
end
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end

2 comments
Thank you for that :)
No problem! We're here if you need us :D