I'm making a point giver so if the player has a gamepass it gives them a certain amount of points, but it seems my code won't work!
local DiamondDollors = game.Players.LocalPlayer.leaderstats.DiamondDollors
local Amount = 20000
local passId = 5888493
local marketplaceService = game:GetService("MarketplaceService")
marketplaceService.PromptPurchaseFinished:connect(function(player,assetId,isPurchased)
if isPurchased then
if assetId == passId then
DiamondDollors.Value = DiamondDollors.Value + Amount
end
end
end)
I don't understand why the script won't work, and I've tried researching it, and there's no errors or anything. So, I've turned to you guys! Any help or answers are very much appreciated!

5 comments
im not really sure but i think this needs to be script not localscript and you can't use game.Players.LocalPlayer
This is true, ServerScripts can’t reference game.Players.LocalPlayer because it doesn’t have one
Not due to FE. But because the server has no player of its own.
tell a parent to get the local child and you see what happens
Thanks for all of your help guys! The script is inside a ServerScript, but calls local functions, does this cause it to break? Plus, calling upon the parent for child didn't seem to work!