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

One DataStore storing two individual numbers?

Asked by 8 years ago

Sorry if this is a really stupid question, I'm very new to DataStores.

For my game, it asks you questions and gives you two answers to choose from. For each one, I want a number value to equal the number of people that chose that one over the other one. I currently have been testing it with two data stores, but is it possible to do it with one? I'd still need to access each number individually and work with it.

0
You could make it a table instead. local tab = {[1] = 50, [2] = 55} TheDeadlyPanther 2460 — 8y
0
I need it to be permanent and able to change live across all servers, so I have to use DataStores. DemonicWolf943 5 — 8y
0
He meant you can save a table to DataStore. Pyrondon 2089 — 8y

1 answer

Log in to vote
2
Answered by 8 years ago

As it has been said in the comments, save it to a table:

num1 = 7 -- Any integer
num2 = 123 -- Any integer
ds = game:GetService("DataStoreService"):GetDataStore("Numbers")
ds:SetAsync(game.Players.Player1.userId,{num1,num2})

Next time please answer the question so it doesn't appear in the unanswered question sort.

Ad

Answer this question