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

how to change the value of a table thats already made?

Asked by 6 years ago

so i have this script

01DataTable[Player] = {
02    Level = 1,
03    currentEXP = 0,
04    Cash = 0,
05    AlphaPlayer = 1, --Disable on full version
06}
07for i = 1, #Tools do
08    table.insert(DataTable[Player],tostring(Tools[i]))
09end
10table.insert(DataTable[Player],"CandyCorn")
11DataTable[Player].CandyCorn = true
12DataStore:SetAsync(PlayerKey, DataTable[Player])

but i cant seem to change the value of Candy Corn Before it gets saved any ideas on how to do this?

0
You can't do DataTable[Player], but you could do DataTable["Player"] or DataTable.Player User#22219 20 — 6y

2 answers

Log in to vote
1
Answered by 6 years ago

Line 1: DataTable.Player, line 8, 10, 11, 12: DataTable.Player

0
im a bit confused about what u mean by that... ForgotenR4 68 — 6y
0
Change those lines. User#22219 20 — 6y
0
??? ForgotenR4 68 — 6y
0
Change line 1 to DataTable.Player, etc User#22219 20 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
001local Module = require(game.ServerStorage.Tools)
002Tools = Module.SimpleNames
003 
004local DataStoreService = game:GetService("DataStoreService")
005local ReplicatedStorage = game:GetService("ReplicatedStorage")
006 
007local DataStore = DataStoreService:GetDataStore("CandySimulatorGameStoreDevAlpha30")
008local DataTable = {}
009 
010local AutosaveInterval = 60
011local AutosaveTick = 0
012 
013local PlayerList = Instance.new("Folder")
014PlayerList.Name = "PlayerList"
015PlayerList.Parent = ReplicatedStorage
View all 138 lines...

Answer this question