Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Datastore2 is not saving. Even though it says Saved DATA in the output. (?)

Hi! So, I'm using Datastore2 to try and save the data that I want to be saved but, It does not save

Have a look at the script (I tried using Remote Events and normally and they both did not work).

local datastore2 = require(game.ServerScriptService.MainModule)

datastore2.Combine("DATA", "Stage")

game.Players.PlayerAdded:Connect(function(player)
	local stagesStore = datastore2("Stage", player)
	
	local function changeStage(amount)
		game.ReplicatedStorage.EventRemotes.ChangeStage:FireClient(player, amount)
	end
	
	local ls = Instance.new("Folder",player)
	ls.Name = "leaderstats"
	
	local Stage = Instance.new("IntValue")
	Stage.Name = "Stage"
	Stage.Value = stagesStore:Get(1) 
	Stage.Parent = ls
	
	stagesStore:OnUpdate(changeStage)


   ls.Parent = player
end)


2 comments

0

Answered, also can you set my answer on your last post as the answer?

0

Oh, sorry that i didnt answer you.

1 answer

You need a boolValue named SaveInStudio into serverstorage.

3 comments

0

I did

0

And it did not work.

0

are you changing the amount via client? if so dont, change it via server with YouData:Increment(value)

This discussion is preserved as it was. New answers, comments, and votes are closed.