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

How do I remove something of of a Database?

Asked by 9 years ago

Its me again. After my brother and I started playing the game. I noticed that my economy was getting inflated. How do I reset the database to remove my code?

I used the database by jcs801

01-- Read the description of the model for details, it pretty much says to just put it in.
02 
03 
04function onPlayerEntered(player)
05wait()-- Change to wait for player longer.
06player:WaitForDataReady()
07repeat wait() until player:FindFirstChild("leaderstats")
08if player.DataReady then
09if player:findFirstChild("leaderstats") then
10local score = player.leaderstats:GetChildren()
11for i = 1,#score do
12local ScoreLoaded = player:LoadNumber(score[i].Name)
13wait()
14if ScoreLoaded ~= 0 then
15score[i].Value = ScoreLoaded
View all 32 lines...
0
I've given you an answer but take note it isn't called Database XD, It's referred to as "Data Persistence" Acheo 230 — 9y
0
I had to update my code with a fix, you may want to use the updated post. Acheo 230 — 9y

1 answer

Log in to vote
0
Answered by
Acheo 230 Moderation Voter
9 years ago

What I did was simply renamed your databases by adding on to it with another key.

01function onPlayerEntered(player)
02wait()-- Change to wait for player longer.
03player:WaitForDataReady()
04repeat wait() until player:FindFirstChild("leaderstats")
05if player.DataReady then
06if player:findFirstChild("leaderstats") then
07local score = player.leaderstats:GetChildren()
08for i = 1,#score do
09local ScoreLoaded = player:LoadNumber(score[i].Name.."DP")
10wait()
11if ScoreLoaded ~= 0 then
12score[i].Value = ScoreLoaded
13end
14end
15end
View all 29 lines...
0
Now if your default database was "Item" it now saves under the persistence of "ItemDP" Acheo 230 — 9y
0
Shouldn't the .."DP" be on the Name and not the Value on line 23? NullSenseStudio 342 — 9y
0
Thanks, I overlooked that :-) thenasafarouk 25 — 9y
0
@Null, he's saving it as a data persistence. If he were to do what you're thinking of, he'd have to rename everything that he has saving. It's easier to save it with an extra string attatched. Acheo 230 — 9y
0
You're correct. I've fixed the issue. Acheo 230 — 9y
Ad

Answer this question