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

Why isnt this awarding any points and no Errors?

I'm trying to make an award system but its not working with Player Points, Help?

-- Local script
local Player = game.Players.LocalPlayer
local RemoteEvent = game.ReplicatedStorage:WaitForChild('RemoteEvent')
RemoteEvent:FireServer(Player.UserId)
-- Server Script
local PlayerPoints = game:GetService('PointsService')
local RemoteEvent = game.ReplicatedStorage.RemoteEvent
local Player = game.Players

RemoteEvent.OnServerEvent:connect(function(Plr)
PlayerPoints:AwardPoints(Plr, 5)
end)

1 answer

✓ Accepted answer

You don't need to sent the players userid as the server has access to this information.

The first argument of remote events/functions will always be the player when fireing the server then any variant arguments are next.

The simplest solution local script

local Player = game.Players.LocalPlayer
local RemoteEvent = game.ReplicatedStorage:WaitForChild('RemoteEvent')
RemoteEvent:FireServer() -- we don't need to sent any info so don't waste the net traffic

server script

local PlayerPoints = game:GetService('PointsService')
local RemoteEvent = game.ReplicatedStorage.RemoteEvent
local Player = game.Players

RemoteEvent.OnServerEvent:connect(function(Plr) -- the server will know who fired the event
	PlayerPoints:AwardPoints(Plr.UserId, 5) -- all we need to do is get the players user id
end)

Hope this helps.

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