Data store saving problem

Hey bro. I am all down for writing your own datastore stuff but if you just want an easy solution to creating a datastore, managing client data and stuff safely and again pretty easy just use ProfileStore.

Example of saving data can be found here: Tutorial - ProfileStore


Now with your issue could you provide any logs if there is any in the console? If you don’t know how to open it just go to view and there should be a console icon you can click on otherwise just click F9 on your keyboard. You can see both client and server logs from there (if there is any) send any relevant logs please.

Secondly. I don’t recommend doing this, I feel this will cause a problem later on. What will happen if the instance is deleted or replaced somehow also why not just run this in a local script?



Exp.Changed:Connect(function()
		while Exp.Value >= RequiredExp.Value do
			Exp.Value -= RequiredExp.Value
			Level.Value += 1
			Tokens.Value += 1

			if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
				local sound = game.Workspace.Sounds.LevelUpSound:Clone()
				sound.Parent = player.Character.HumanoidRootPart
				sound:Play()
				Debris:AddItem(sound, 4)
			end

			RequiredExp.Value = Level.Value * 300
		end
	end)

One last question why aren’t you using the actual saving function instead? I personally have not really touched updated but surely you should be using the save function instead for saving no?



	local success = false
	local errorMessage

	for attempt = 1, 5 do
		success, errorMessage = pcall(function()
			playerDataStore:UpdateAsync(key, function(oldData)
				return deepCopy(data)
			end)
		end)
		if success then
			break
		else
			warn("Attempt " .. attempt .. " to save data for " .. player.Name .. " failed: " .. tostring(errorMessage))
			task.wait(1)
		end
	end

	if not success then
		warn("[CRITICAL] Failed to save data for " .. player.Name .. " after multiple attempts.")
	end