So, when I was playing with my friend in my game, when he joined, he got the exact same data as me, but it was the first time joining my game, so that shouldn't be happening. My script:
local purchasedfolder = game.Workspace.PurchasedValues
local HttpService = game:GetService("HttpService")
local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("CarPurchasedDataStore")
game.Players.PlayerAdded:Connect(function(player)
local key = player.Name.."-"..player.UserId
local encodedData = nil
pcall(function()
encodedData = DataStore:GetAsync(key)
end)
if encodedData ~= nil then
local data = HttpService:JSONDecode(encodedData)
-- Set the values from the decoding
purchasedfolder.Purchasedbmw.Value = data[1]
purchasedfolder.Purchasedgtr.Value = data[2]
purchasedfolder.Purchasedhoon.Value = data[3]
purchasedfolder.Purchasedmc.Value = data[4]
purchasedfolder.Purchasedpor.Value = data[5]
purchasedfolder.Purchaseds13.Value = data[6]
print("Loaded all the values")
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local data = {
purchasedfolder.Purchasedbmw.Value,
purchasedfolder.Purchasedgtr.Value,
purchasedfolder.Purchasedhoon.Value,
purchasedfolder.Purchasedmc.Value,
purchasedfolder.Purchasedpor.Value,
purchasedfolder.Purchaseds13.Value
}
local key = player.Name.."-"..player.UserId
local normalData = HttpService:JSONEncode(data)
DataStore:SetAsync(key,normalData)
end)

4 comments
You have already posted this before, bruh.
I know, but no one answered so I'm allowed to repost.
Fine then i'm reposting mine then
Hi! I have not learned about DataStore but it seems like you never actually loaded a specific players data. I think it takes the data of the first person that entered and bases that data for other players. Try making your friend go first (make sure he has Dif stats), and check to see if you copy his stats.