generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

I need help with adding player points to my game

Previous Thread :: Next Thread 
Sk8erDan is not online. Sk8erDan
Joined: 22 Mar 2010
Total Posts: 4565
05 Feb 2016 02:55 PM
I wanted to add Player Points to my game (awarded 1 after completing an event)

So, I went on the ROBLOX Wiki.

After massive brain farts i just copied their excercise solution.

local PointsService = game:GetService("PointsService")

function awardPoints(creator)
if time() - lastAwardedTime < 5 then
return
else
lastAwardedTime = time()
PointsService:AwardPoints(creator.Value, 1)
end
end

of course it didnt work.

Any reason why? I just copied the whole thing and pasted it here:

while true do
wait(intermission)
local event=events[math.random(#events)]
if event~=nil then
event.code()
wait(events.length)
local PointsService = game:GetService("PointsService")

function awardPoints(creator)
if time() - lastAwardedTime < 1 then
return
else
lastAwardedTime = time()
PointsService:AwardPoints(creator.Value, 1)
end
end
end
end


Builder | RIP Dannyha,DANNYHA7,dannyha4,dannyha6,dannyha5,dannyha123, etc. | R$1337 Tx392
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
05 Feb 2016 02:59 PM
PointsService:AwardPoints(creator.Value, 1)

try

PointsService:AwardPoints(game.Players:FindFirstChild(creator.Value).userId, 1)
Report Abuse
Sk8erDan is not online. Sk8erDan
Joined: 22 Mar 2010
Total Posts: 4565
05 Feb 2016 04:32 PM
sorry, where do i put that

i was inactive


Builder | RIP Dannyha,DANNYHA7,dannyha4,dannyha6,dannyha5,dannyha123, etc. | R$1337 Tx392
Report Abuse
Duncan2468 is not online. Duncan2468
Joined: 22 Dec 2011
Total Posts: 968
05 Feb 2016 04:35 PM
call it after the function

~ Sincerely, Duncan ~
Report Abuse
Sk8erDan is not online. Sk8erDan
Joined: 22 Mar 2010
Total Posts: 4565
05 Feb 2016 05:05 PM
wait im dumb recurring i already put that





Builder | RIP Dannyha,DANNYHA7,dannyha4,dannyha6,dannyha5,dannyha123, etc. | R$1337 Tx392
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
05 Feb 2016 05:09 PM
no i meant replace the first line i pasted with the second line i typed out
Report Abuse
Sk8erDan is not online. Sk8erDan
Joined: 22 Mar 2010
Total Posts: 4565
05 Feb 2016 06:31 PM
dangit why didnt i see that


Builder | RIP Dannyha,DANNYHA7,dannyha4,dannyha6,dannyha5,dannyha123, etc. | R$1337 Tx406
Report Abuse
karuza26 is not online. karuza26
Joined: 18 Apr 2011
Total Posts: 211
05 Feb 2016 06:33 PM
this is a Coin Base PP Giver


local award = game.ReplicatedStorage.GameSettings.PlayerPoints.Value
script.Parent.Touched:connect(function(plr)
wait()
local i = plr.Parent.Name
if plr.Parent:findFirstChild("Humanoid") then
print(plr.Parent.Name)
game:GetService("PointsService"):AwardPoints(game.Players:findFirstChild(i).userId, award)
game.Players:FindFirstChild(i):LoadCharacter()
print("given the player "..award.." points!")
script.Parent.PlayerPoints:Play()
end
end)
Report Abuse
Sk8erDan is not online. Sk8erDan
Joined: 22 Mar 2010
Total Posts: 4565
05 Feb 2016 06:38 PM
small detail: lastAwardedTime has a blue squiggle under it. I do not know why :(


Builder | RIP Dannyha,DANNYHA7,dannyha4,dannyha6,dannyha5,dannyha123, etc. | R$1337 Tx406
Report Abuse
cheesecake123456 is not online. cheesecake123456
Joined: 01 Jun 2009
Total Posts: 1529
05 Feb 2016 06:42 PM
Change it to local lastAwardedTime if it is only used inside one function.
Report Abuse
Sk8erDan is not online. Sk8erDan
Joined: 22 Mar 2010
Total Posts: 4565
05 Feb 2016 06:46 PM
curse my 1% knowledge at scripting.

Where do I put it.

I put it before the function (the only function in the script is the player point one)

local function awardPoints(creator)
if time() - lastAwardedTime < 1 then
return
else
lastAwardedTime = time()
PointsService:AwardPoints(game.Players:FindFirstChild(creator.Value).userId, 1)
end
end
end
end

no errors, but the lastawardedtime is still a blue squiggle.



Builder | RIP Dannyha,DANNYHA7,dannyha4,dannyha6,dannyha5,dannyha123, etc. | R$1337 Tx406
Report Abuse
cheesecake123456 is not online. cheesecake123456
Joined: 01 Jun 2009
Total Posts: 1529
05 Feb 2016 06:50 PM
Remove that local XD
Hovering over lastAwardedTime will tell you what is wrong with it.
Report Abuse
Sk8erDan is not online. Sk8erDan
Joined: 22 Mar 2010
Total Posts: 4565
05 Feb 2016 06:51 PM
By the way, I am trying to award everyone in the server playerpoints.


Builder | RIP Dannyha,DANNYHA7,dannyha4,dannyha6,dannyha5,dannyha123, etc. | R$1337 Tx406
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image