i fixed your code i will give you screenshots if it worked
my code was so broken
in game
rejoined then it generates nums
u may wonder
but per second it adds 1 into the data
here take the place i meant script
local DataStore2 = require(game.ServerStorage:WaitForChild("DataStore2"))
DataStore2.Combine("DATA", "Coins") -- pls add more strings if u want to save data in other values
function plrAdds(player)
local CoinStore = DataStore2("Coins", player) -- copy and paste then change variable and string to make a new data remember match the string name to the exact thing in the combine
local lb = Instance.new("Folder")
lb.Parent = player
lb.Name = "leaderstats"
local Coins = Instance.new("NumberValue")
Coins.Parent = lb
Coins.Name = "Coins"
Coins.Value = CoinStore:Get(0)
CoinStore:OnUpdate(function(value)
Coins.Value = value
end)
end
for i, plr in pairs(game.Players:GetPlayers()) do
plrAdds(plr)
end
game.Players.PlayerAdded:Connect(plrAdds)
while true do
wait(1)
for i ,plr in pairs(game.Players:GetPlayers()) do
local CoinStore = DataStore2("Coins", plr)
CoinStore:Increment(1)
end
end
then get datastore2 by kampfkarren
and put it into server storage
and after that publish and enable api services
then it saves
EDIT: Make a bool value in ServerStorage and name it SaveInStudio and ofcourse change the value to true if u want to save it in studio
the while loops
– u dont need this only a test my guy and if using a tool click use if Debounce == false then