So I’m having a weird issue when I try and change the players data. I am printing everything out to the console and all looks good until you look at the actual data.
function DataService:SetData(player, data, value)
local playerData = DataService._playerData[tostring(player.UserId)]
if not playerData then return end
print("CHANGING DATA", tostring(player.UserId), data, value)
DataService._playerData[tostring(player.UserId)][data] = value
print(DataService._playerData)
DataService:ReplicateData(player)
DataService.DataChanged:Fire(player, data, value)
end
When I print changing data everything looks correct but all the players in the game are effected by the:
DataService._playerData[tostring(player.UserId)][data] = value
Here is an example, I call DataService:SetData(randomPlayer, “Health”, 50). This should set the player ‘randomPlayer’ health value to 50, however it sets everyone in the games health value to 50 and I’m not sure why.