How do i make a kill system with player points in my sword fighting game?
Like 1 kill = 1 player point? been stuck with this for hours now! please help!
does this work?
local PointsService = Game:GetService('PointsService') _G.GivePlayerPoints = function(player, points) if player and points then points = math.floor(points) local success, errorText = pcall(function() local pointsAvailable = PointsService:GetAwardablePoints() local pointsToAward = math.min(points, pointsAvailable) _G.print(script.Name, "Awarding:", pointsToAward, "Total available:", pointsAvailable) PointsService:AwardPoints(player.userId, pointsToAward) _G.print(script.Name, "Done.\n") end) if not success then _G.print(script.Name, "FAILURE! ErrorMsg:", errorText) end end end
Hey there, this wiki page might be helpful: http://wiki.roblox.com/index.php?title=Points_Tutorial
As explained in the above link, a game will have a pool of points to give out. One point is generated in that pool per 1 robux spent in your game. (You can only give out points if someone has bought something like a game pass in your game)
Once you are clear with that, the functions you need are in the page I linked. Good luck!
EDIT: You added code while I was typing my post :P I'm not sure if that will work. Once you have some points to give out you can test it though.