Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Help with Player Points please? [SOLVED]

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!

4 comments

0

If you use a local script, you can give the points to game.Players.LocalPlayer.userId

0

So I change it to "...Points(game.Players.LocalPlayer.userId, 1)"? And yes, it is in a LocalScript.

0

Yes, it should work.

0

Thanks a lot!

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.