Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-2

Keeping play score? [closed]

Asked by 10 years ago

I'm trying to make a game sorta like cookie clicker, and was wondering, how do you set a text that only the player can see of the players points (Cookies if you like)?

Closed as Not Constructive by Sublimus, TheGuyWithAShortName, and evaera

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 10 years ago

This is Data Persistence. It saves everything on the leaderboard.



function onPlayerEntered(player) wait()-- Change to wait for player longer. player:WaitForDataReady() repeat wait() until player:FindFirstChild("leaderstats") if player.DataReady then if player:findFirstChild("leaderstats") then local score = player.leaderstats:GetChildren() for i = 1,#score do local ScoreLoaded = player:LoadNumber(score[i].Name) wait() if ScoreLoaded ~= 0 then score[i].Value = ScoreLoaded end end end end end function onPlayerLeaving(player) if player:findFirstChild("leaderstats") then local score = player.leaderstats:GetChildren() for i = 1,#score do player:SaveNumber(score[i].Name,score[i].Value) end end end game.Players.PlayerAdded:connect(onPlayerEntered) game.Players.PlayerRemoving:connect(onPlayerLeaving)
0
Woops, i wrote my Question wrong.. >.< re read it. Sorry. XD starkiller523 65 — 10y
0
Ew, data persistence. It's all about Data Store now. TheGuyWithAShortName 673 — 10y
0
I don't understand the question now yzeerf1313 25 — 10y
0
Example: On a cookie clicker game there is a Text that shows your cookies. That's what I'm trying to do. :p starkiller523 65 — 10y
0
Oh on the screen. Well I am not sure about that yzeerf1313 25 — 10y
Ad