heres the script:

local DSS = game:GetService("DataStoreService")
local DS1 = DSS:GetDataStore("Coins")
local DS2 = DSS:GetDataStore("Multiplier")
game.Players.PlayerAdded:Connect(function(Player)
	local stats = Instance.new("Folder", Player)
	stats.Name = "leaderstats"
	local Coins = Instance.new("NumberValue", stats)	
	Coins.Name = "Coins"
	Coins.Value = DS1:GetAsync(Player.UserId) or 0
	local Multiplier = Instance.new("IntValue", stats)
	Multiplier.Name = "Multiplier"
	Multiplier.Value = DS2:GetAsync(Player.UserId) or 0
	game.Players.PlayerRemoving:Connect(function(Player)
		DS1:SetAsync(Player.UserId, Coins.Value)
		DS2:SetAsync(Player.UserId, Multiplier.Value)
	end)
	end)

3 comments

0

it might be creating two values but only saving one of them, check in the explorer

0

I would recommend saving tables for these two values

0

You don't need two separate datastores for two values. Just store both values in a table and save the table (or its JSON Data)