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

This leaderboard saves data when I am testing it in studio but not when I play it on roblox? [closed]

Asked by 6 years ago

01local DSService = game:GetService("DataStoreService"):GetDataStore("Currency")
02local Saving = 0
03 
04game:BindToClose(function()
05    repeat wait() until Saving <= 0
06end)
07 
08game:GetService("Players").PlayerAdded:connect(function(plr)
09    local leader = Instance.new("Folder",plr)
10    leader.Name = "leaderstats"
11 
12        local Credits = Instance.new("IntValue",leader)
13        Credits.Name = "Credits"
14 
15        local Diamonds = Instance.new("IntValue",leader)
View all 34 lines...
0
Good habit to put datastore in modulescripts, just saying. TiredMelon 405 — 6y
0
Try putting the :GetAsync() and :SetAsync() methods in a pcall Trainsparency 39 — 6y
0
how to I put them in a pcall jakebball2014 84 — 6y

Marked as Duplicate by arshad145, User#21908, and User#19524

This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.

Why was this question closed?

2 answers

Log in to vote
0
Answered by
Echtic 128
6 years ago

Try putting wait() on top of the script, that should fix it.

Ad
Log in to vote
0
Answered by 6 years ago

Try using pcall. Also please do not use Instance.new with parent parameter, it's deprecated. Same with connect, use Connectinstead.

0
deprecated for connect and the parent paramerter mean nothing. These will probley never being going away as so meny users use those functions. outlook1234567890 115 — 6y