Kampfkarren / Roblox

Scripts and stuff I wrote for Roblox. Documentation is little to none as these are just stuff I took from my game that I thought I could share.
https://kampfkarren.github.io/Roblox/
Other
284 stars 78 forks source link

:GetTable() also getting the table in the parameters, even though the player is the second time player #106

Closed ndan0 closed 4 years ago

ndan0 commented 4 years ago

I have the table data that took some default placement for new players, when the new player joins, the game will set up for first time player. but when the player rejoin the game, they got the default table data, and their own table data.

Kampfkarren commented 4 years ago

I have no idea what this is reporting. Can you provide a code example, what is happening, and what you expect?

ndan0 commented 4 years ago

ok so I get player saved data, this is placement data --[[ function remotes.DSPlacement.OnServerInvoke(player) local tycoonObjects = DataStore2("TycoonObjects",player) return tycoonObjects:GetTable({

    ["-7, 2, 9, 0, 0, -1, 0, 1, 0, 1, 0, 0"] = 1,
    [" -7, 2, 1, 0, 0, 1, 0, 1, 0, -1, 0, 0"] = 1,
    ["-11, 2, 1, 0, 0, 1, 0, 1, 0, -1, 0, 0"] = 1,
    ["-11, 2, 9, 0, 0, -1, 0, 1, 0, 1, 0, 0"] = 1,
    [" 23, 2, -25, -1, 0, 0, 0, 1, 0, 0, 0, -1"] = 6,

})

end ]]

so when the player first join, the above is their data

and then the player will do some thing like placing and deleting

then I save the table when player leave

Now the player rejoined, the player get the data of theirself AND the data for new player.

if I remove the data inside the GetTable, the player gets the data that they owned and not the data they owned AND new player data

Kampfkarren commented 4 years ago

Yeah, that's what :GetTable is meant to do. If you don't have any of the keys it has, then it'll add them. Are you sure you didn't just want :Get instead?

ndan0 commented 4 years ago

wait, so It's a feature?, does Get work with table?, ok so I am a bit confused there sorry

ndan0 commented 4 years ago

yup, I will close it