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

Help with Player Points please? [SOLVED]

Asked by 10 years ago

04-26-2014 06:02 AM I asked weather this code it correct, reply was "user is undefined". I would like to change it to the player that clicked it. Here's part of the script:

local PointsService = Game:GetService("PointsService")
PointsService:AwardPoints(user.userId, 1)

Here's the full script:

local buyButton = game.Workspace.BuyButton.SurfaceGui.TextButton

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.Gold.Value + 25000
PointsService:AwardPoints(user.userId, 1)
end)

I would greatly appreciate any fixes.

Also, I would like to request How to get the player when the GUI is clicked. For example: BOB clicks the GUI, I would like to know the code on how to get his character.

Thanks!

0
If you use a local script, you can give the points to game.Players.LocalPlayer.userId ForeverDev 155 — 10y
0
So I change it to "...Points(game.Players.LocalPlayer.userId, 1)"? And yes, it is in a LocalScript. fahmisack123 385 — 10y
0
Yes, it should work. ForeverDev 155 — 10y
0
Thanks a lot! fahmisack123 385 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

Already answered. Putting this so it isn't marked unanswered.

Ad

Answer this question