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

Why Doesn't this work?

Asked by 10 years ago

I have this script, but it won't award the Player Point to the player:

local buyButton = game.Workspace.Buttons.BuyButton.SurfaceGui.TextButton
local user = game.Players.LocalPlayer.userId
buyButton.MouseButton1Click:connect(function()
    local productId = 19251902
    Game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId)
    local PointsService = Game:GetService("PointsService")
    game.Players.LocalPlayer.leaderstats.Diamonds.Value = game.Players.LocalPlayer.leaderboard.Diamonds.Value + 10
    PointsService:AwardPoints(user, 1)
end)

Everything is in a LocalScript, the purchase and the Diamonds work fine, but the points don't. Why?

1 answer

Log in to vote
0
Answered by 10 years ago

it needs to be

local buyButton = game.Workspace.Buttons.BuyButton.SurfaceGui.TextButton
local user = game.Players.LocalPlayer.userId
buyButton.MouseButton1Click:connect(function()
    local productId = 19251902
    Game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId)
    local PointsService = Game:GetService("PointsService")
    game.Players.LocalPlayer.leaderstats.Diamonds.Value = game.Players.LocalPlayer.leaderstats.Diamonds.Value + 10
    PointsService:AwardPoints(user, 1)
end)

simple error you wrote leaderboard instaed of stats

0
LOL, didn't notice that... Thanks, but it's the Player Points that i'm stuck on. fahmisack123 385 — 10y
Ad

Answer this question