How do I convert these scripts to R6?

  1. What do you think caused the players to have their Parkour level reset?
  1. Not entirely sure, might be that their levels did not save properly when they left. Might be a good idea to implement an auto save feature (maybe save the data every minute or two)
  1. In the following video, if you look closely, you can see that when I die I appear for 1 millisecond in the air, and then I just appear in my level. Do you know how to remove that or what causes it?
  1. That is supposed to happen, your character loads and since there is no spawn location you load mid air and then get teleported to your stage.
  1. Is there any way that when I die I don’t immediately reappear in my level? For example, I would like that when I die it takes 0.5 seconds to reappear and that it is not immediate.

Change:

char.Humanoid.Died:Connect(function()
     plr:LoadCharacter()
end)

to:

char.Humanoid.Died:Connect(function()
     wait(0.5)
	 plr:LoadCharacter()
end)

But then, the script I have doesn’t have that automatic save every 2min, so how often is the progress of the players saved in this script you gave me?

Oh I understand, I just saw that other parkours didn’t have that problem, but it’s not such a big problem.

Thanks, it worked correctly

1 Like

But then, the script I have doesn’t have that automatic save every 2min, so how often is the progress of the players saved in this script you gave me?

It only saves when the player leaves. If you want to save player data every minute, just add:

local save = coroutine.create(function()
    while wait(60) do
      savePlrData(plr)
    end
end)
coroutine.resume(save)

You should put this under:

    end)
	plr:LoadCharacter()

image Like this? :frowning:

No, the end) after plr:LoadCharacter() should go after coroutine.create(save).

    end)
	plr:LoadCharacter()
    local save = coroutine.create(function()
       while wait(60) do
         savePlrData(plr)
       end
    end)
    coroutine.resume(save)
end)

image :sob: :sob: ???

What is the error? A picture of the code does not help much.

Well, I don’t know, I want to know if I’m doing what you’re telling me right. Here is the code anyway:

local players = game:GetService("Players")
local dataStoreService = game:GetService("DataStoreService")
local saveDataStore = dataStoreService:GetDataStore("SaveDataTest")

local function savePlrData(plr)
	local success,err = pcall(function()
		local saveData = {}
		for _,stat in pairs(plr.leaderstats:GetChildren())do
			saveData[stat.Name] = stat.Value
		end
		saveDataStore:SetAsync(plr.UserId,saveData)
	end)
	if not success then return err end
end

players.PlayerAdded:connect(function(plr)
	local stats = Instance.new("Folder")
	stats.Name = "leaderstats"
	stats.Parent = plr

	local stage = Instance.new("IntValue")
	stage.Name = "Stage"
	stage.Parent = stats

	local data = saveDataStore:GetAsync(plr.UserId)
	if data then
		print(data.Stage)
		for _,stat in pairs(stats:GetChildren()) do
			stat.Value = data[stat.Name]
		end
	else
		print(plr.Name .. " has no data")
	end

	wait(workspace.ObbyStages:WaitForChild(stage.Value))
	local start = workspace.ObbyStages:WaitForChild("0")
	plr.CharacterAdded:connect(function(char)
		wait()
		if stage.Value == 0 then     
			local destination = start.CFrame + Vector3.new(0,3,0)
			char:SetPrimaryPartCFrame(destination)
		else
			local part = workspace.ObbyStages:FindFirstChild(stage.Value)
			local destination = part.CFrame + Vector3.new(0,3,0)
			char:SetPrimaryPartCFrame(destination)
		end

		char.Humanoid.Died:Connect(function()
			wait(0.5)
			plr:LoadCharacter()
		end)
	end)
	plr:LoadCharacter()
	local save = coroutine.create(function()
		while wait(60) do
			savePlrData(plr)
		end
	end)
	coroutine.resume(save)
end)

players.PlayerRemoving:connect(function(plr)
	local err = savePlrData(plr)
	if err then print(err) end
end)

game:BindToClose(function()
	for _,plr in pairs(players:GetPlayers()) do
		local err = savePlrData(plr)
		if err then print(err) end
	end
end)

It is that, you tell me to add something to the script so that the saving of the levels is every minute, then I want to know if I am doing it right.

Yes it is correct, you can add a print statement to the savePlrData function to make sure it is saving every minute.

Uhm…? I’d like to know if this new thing of auto-saving levels every minute would make the game heavier or that there is lag.

It probably wont cause lag at all.

Using HumanoidRootPart is the way to make sure that your scripts work for both R6 and R15. Using Torso, for example, will only work on R6, and using UpperTorso will only work on R15. HRP is what I always recommend using, as there’s not really any advantage to using Torso.

Hey, one last thing, I didn’t understand what you said, what do you mean?

You can change:

local function savePlrData(plr)
	local success,err = pcall(function()
		local saveData = {}
		for _,stat in pairs(plr.leaderstats:GetChildren())do
			saveData[stat.Name] = stat.Value
		end
		saveDataStore:SetAsync(plr.UserId,saveData)
	end)
	if not success then return err end
end

to:

local function savePlrData(plr)
	local success,err = pcall(function()
		local saveData = {}
		for _,stat in pairs(plr.leaderstats:GetChildren())do
			saveData[stat.Name] = stat.Value
		end
		saveDataStore:SetAsync(plr.UserId,saveData)
	end)
	if not success then return err end
    if success then print(plr .. " data has been saved" ) end
end

so it prints out that a player’s data has been successfully saved, just use this in testing to make sure it saves correctly.

If I don’t do it, is there any risk that the players will have their level reset again?

No, it is a simple print statement that prints when a player’s data has been saved. It has absolutely no effect on game-play

Hello again, I am contacting you again about a problem reported to me by 2 users.


She is basically saying:

"There is a super mega annoying bug, I was at level 200 and so on, and when I joined now in the afternoon it sent me up to 20 levels behind, and that had already happened to me before, and I had spent robux to give skip in difficult levels and apparently I was scammed because I was 20 levels behind, very bad but very bad."

Do you have any idea what it might be? I’m really worried about it, as this bug is worse than the previous one that happened.

NO NO NO NO IT DOESN’T HELP, SOMETHING IS WRONG WITH THE SYSTEM, MY SECONDARY ACCOUNT HAD ITS LEVEL RESET, AND WHEN A PLAYER EXITS THE GAME I GET THIS MESSAGE FROM THE CONSOLE:

it just means that the game got to much request, its easy to fix, just add 6+ seconds of wait below the line:

saveDataStore:SetAsync(plr.UserId,saveData)
--then do wait ()