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 |
|
|
|
| 05 Feb 2016 02:59 PM |
PointsService:AwardPoints(creator.Value, 1)
try
PointsService:AwardPoints(game.Players:FindFirstChild(creator.Value).userId, 1) |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 05 Feb 2016 04:35 PM |
call it after the function
~ Sincerely, Duncan ~ |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 05 Feb 2016 06:42 PM |
| Change it to local lastAwardedTime if it is only used inside one function. |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 05 Feb 2016 06:50 PM |
Remove that local XD Hovering over lastAwardedTime will tell you what is wrong with it. |
|
|
| Report Abuse |
|
|
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 |
|
|