Datastore not working in studio

This may help you out DataStore (Saving & Loading Player Data) - Roblox Scripting Tutorial - YouTube

so something like this but everthing inside of it?

		MyData:SetAsync(player.UserId, {
			["-Level"] = player.GLevel.Value,
			["-Exp"] = player.GLevel.Current.Value,
			["-SLevel"] = player.SLvl.Value,
			["-Exp2"] = player.SLvl.Exp.Value
		})

Yes and use :UpdateASync() when saving datas

where would i type this? aaaaaaaaaaaaa

		MyData:SetAsync(player.UserId, {
			["Level"] = player.GLevel.Value,
			["Exp"] = player.GLevel.Current.Value,
			["SLevel"] = player.SLvl.Value,
			["Exp2"] = player.SLvl.Exp.Value,
			["FLevel"] = player.FLvl.Value,
			["Exp3"] = player.FLvl.Exp.Value,
			["SpawnL"] = player.SpawnL.Value,
			["Fruit"] = player.Fruit.Value,
			["Sword"] = player.Sword.Value,
			["Melee"] = player.Melee.Value
		}):UpdateASync()

here?, idk anymore im losing my brain cells

oh like this?

		MyData:UpdateAsync(player.UserId, {
			["Level"] = player.GLevel.Value,
			["Exp"] = player.GLevel.Current.Value,
			["SLevel"] = player.SLvl.Value,
			["Exp2"] = player.SLvl.Exp.Value,
			["FLevel"] = player.FLvl.Value,
			["Exp3"] = player.FLvl.Exp.Value,
			["SpawnL"] = player.SpawnL.Value,
			["Fruit"] = player.Fruit.Value,
			["Sword"] = player.Sword.Value,
			["Melee"] = player.Melee.Value
		})

Read the link i posted.

am i going to reapet for every data?

		local playerData = {
			["Level"] = player.GLevel.Value,
			["Exp"] = player.GLevel.Current.Value,
			["SLevel"] = player.SLvl.Value,
			["Exp2"] = player.SLvl.Exp.Value,
			["FLevel"] = player.FLvl.Value,
			["Exp3"] = player.FLvl.Exp.Value,
			["SpawnL"] = player.SpawnL.Value,
			["Fruit"] = player.Fruit.Value,
			["Sword"] = player.Sword.Value,
			["Melee"] = player.Melee.Value
		}
		MyData:UpdateAsync(player.UserId,function(oldValue)
			local pValue = oldValue or {DataId = 0}
			if playerData.SLevel == pValue.DataId then
				playerData.SLevel = playerData.SLevel + 1
				return playerData
			else
				return nil
			end
		end)

like this:

local playerData = {
			["DataId"] = 0,
			["Level"] = player.GLevel.Value,
			["Exp"] = player.GLevel.Current.Value,
			["SLevel"] = player.SLvl.Value,
			["Exp2"] = player.SLvl.Exp.Value,
			["FLevel"] = player.FLvl.Value,
			["Exp3"] = player.FLvl.Exp.Value,
			["SpawnL"] = player.SpawnL.Value,
			["Fruit"] = player.Fruit.Value,
			["Sword"] = player.Sword.Value,
			["Melee"] = player.Melee.Value
		}
		MyData:UpdateAsync(player.UserId,function(oldValue)
			local pValue = oldValue or {DataId = 0}
			if playerData.DataId == pValue.DataId then
				playerData.DataId = playerData.DataId + 1
				return playerData
			else
				return nil
			end
		end)

k, but now my question is how would i replace the old data with the new data?

Use GetASync(plr.UserId)
Also make sure even the DataId is saving.

thats everything? just the players userid?

yep and it will return as a table with variables

ok idk if this is right please correct me

game.Players.PlayerAdded:Connect(function(player)
	local data
	local success, errormessage = pcall(function()
	 	data = MyData:GetAsync(player.UserId)(player.Character)
	end)
	
	if success then
		player.UserId = data
	else
		print("Error Getting Data")
		warn(errormessage)
	end
end)

its wrong i tested it came a error instantly

Ill help you fix that,

game.Players.PlayerAdded:Connect(function(player)
	local data
	local success, errormessage = pcall(function()
	 	data = MyData:GetAsync(player.UserId)
	end)
	
	if success then
		data = data --Your error: Why are you setting the userid of the player to the data? 
	else
		print("Error Getting Data")
		warn(errormessage)
	end
end)

idk, im school rn and im trying to code while studying

Well it should work, also, study first.

you should save all data into one.