I need help on DataStore2

Ok i’ll wait until you’re done with it, but please hurry.

Is no one answering because no one can’t help me?

There’s a line in the output that says:
“Data store Wins was not saved as it was not updated.”

(I cannot fix it)

1 Like

I got it fixed after rewriting the script

local ServerScriptService = game:GetService("ServerScriptService")
local Datastore = require(script.Parent.Module.DataStore2Module)
local Players = game:GetService("Players")

Datastore.Combine("DATA", "Wins")

Players.PlayerAdded:Connect(function(Player) 

	local Wins = Datastore("Wins", Player)
	Wins:Get(0)
	
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "Data"
	leaderstats.Parent = Player
	local actualleaderstats = leaderstats:Clone()
	actualleaderstats.Name = "leaderstats"
	actualleaderstats.Parent = Player

	local winsstatData = Instance.new("NumberValue")
	winsstatData.Name = "Wins"
	winsstatData.Parent = leaderstats
	local winstats = winsstatData:Clone()
	winstats.Parent = actualleaderstats

	local function WinsUpdated(UpdatedWins)
		winsstatData.Value = UpdatedWins
		winstats.Value = UpdatedWins

	end

	Wins:OnUpdate(WinsUpdated)

end)
3 Likes