-
What do you want to achieve?
I want to change a value in a table like this
['plr1'] = {
['Coins'] = 100
}
['plr2'] = {
['Coins'] = 0
}
['plr3'] = {
['Coins'] = 0
}
-
What is the issue?
It changes all the values in the table
['plr1'] = {
['Coins'] = 100
}
['plr2'] = {
['Coins'] = 100
}
['plr3'] = {
['Coins'] = 100
}
-
What solutions have you tried so far?
I have tried changing the value names and different combinations but I couldn’t find a solution
local ServerData = {}
local NewData = {
['Coins'] = 0;
}
local function loadData(plr)
local data = NewData
ServerData[plr.Name] = data
end
local function applyData(plr)
loadData(plr)
if plr.Name == 'Player1' then
ServerData[plr.Name].Coins = 100
end
print(plr.Name..'--'..ServerData[plr.Name].Coins)
end
game.Players.PlayerAdded:Connect(applyData)
Any help with be appreciated!