How can I update these scripts

But there are more than 100K people who will lose their progress, I can’t do that, the game will be ruined

You did not let me in, I can not edit.

it won’t let me change your status so you can edit

Did you turn the team create on.

Also, I think you can only team create with frainds.

I think if you fraind me, It will work.

Do you have to send me a request?

Yes, let me send the fraind request.

I sent you the fraind request!

And I accepted you! :wink: :wink: :wink: :wink: :wink: :wink: :wink: :wink: :wink: :wink: :wink:

See if you can let me in now. Because we are now frainds

yes now if you leave meye :wink: :wink: :blush:

Why do you keep saying that…

sorry, I am doing a copy and paste since I use the translator but many were pasted

Joining the team create. Also, go to the view tab and click chat so we can talk.

Yeah, that’s the thing.
It shouldn’t.
Tell me if it works though, it won’t really reset data, I said that because when I implemented these changes and fixing some bugs, it reset data.
Don’t publish it to the game though just in case.

EDIT: I know why I said that now. There was a issue where the script wasn’t putting data into the table, thus creating data loss. I fixed it though.

Hello!! :wink: :wink: Look I have two comments to tell you about your script. The level was NOT reset in the leaderboard, BUT the place of the level where I should go was reset, that is, in the leaderboard my level remains the same as I left it, but I do not appear in the corresponding level, since I appear at the start. The second comment I want to say is that the second script you gave me, some lines come out that are misspelled, maybe that could be causing all this problem. Anyway I leave the scripts that I left and how I put them in the game. (Just that problem that I do not appear in my corresponding level, but everything else is excellent, I hope you can solve it and help me, we are so close to solving it :smiley: )

1 script:

local obbyStages = workspace:WaitForChild("ObbyStages")

for _,stage in pairs(obbyStages:GetChildren()) do

	stage.Touched:connect(function(hit)

		local hum

		if hit.Parent:FindFirstChild("Humanoid") then

			hum = hit.Parent.Humanoid

		end

		if hit.Parent and hit.Parent.Parent:FindFirstChild("Humanoid") then

			hum = hit.Parent.Parent.Humanoid

		end

		if hum then

			local plr = game.Players:GetPlayerFromCharacter(hum.Parent)

			local plrStage = plr.leaderstats.Stage.Value

			local stageNum = tonumber(stage.Name)

			if not (stageNum > plrStage + 1) then
				if stageNum > plrStage then
					plr.leaderstats.Stage.Value = plr.leaderstats.Stage.Value + 1
				end
			else
				hum.Health = 0
			end



		end


	end)


end

2 script (This is the one that comes out misspelled, in some parts of the end) :wink: :wave: :

local player = 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

player.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

	coroutine.resume(coroutine.create(function() -- Keeping track of data.
		local rn = nil
		rn = game:GetService('RunService').Heartbeat:connect(function()
			if plr and player:FindFirstChild(plr.Name) then
				local dat = nil
				if Inter[plr.Name] == nil then
					Inter[plr.Name] = {}
					dat = Inter[plr.Name]
				else
					dat = Inter[plr.Name]
				end

				for _,stat in next,plr.leaderstats:GetChildren() do
					dat[stat.Name] = stat.Value
				end
			else
				rn:Disconnect()
			end
		end)
	end))
	plr.CharacterAdded:connect(function(char)

		local humanoid,hrp = char:WaitForChild("Humanoid"),char:WaitForChild("HumanoidRootPart")

		if humanoid and hrp then

			if stage.Value ~= 0 then

				local part = workspace.ObbyStages:FindFirstChild(stage.Value)
				hrp.CFrame = part.CFrame + Vector3.new(0,1,0)


			end

		end

	end)


end)

Sorry for the long delay, I was sleeping.
Anyways,

I fully fixed your script.


It was a problem with script two.
Here’s my solution with script two.

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

local Inter = {
        -- EX: ["Obj_ective"] = {DATA HERE}
}


local function savePlrData(plr,data)

        local success,err = pcall(function()

                local saveData = {}

                for _,stat in pairs(plr.leaderstats:GetChildren())do

                        saveData[stat.Name] = stat.Value

                end

                if not data then
                        saveDataStore:SetAsync(plr.UserId,saveData)
                else
                        saveDataStore:SetAsync(plr.UserId,data)
                end

        end)

        if not success then return err end

end

player.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
        
        coroutine.resume(coroutine.create(function() -- Keeping track of data.
                local rn = nil
                rn = game:GetService('RunService').Heartbeat:connect(function()
                        if plr and player:FindFirstChild(plr.Name) then
                                local dat = nil
                                if Inter[plr.Name] == nil then
                                        Inter[plr.Name] = {}
                                        dat = Inter[plr.Name]
                                else
                                        dat = Inter[plr.Name]
                                end

                                for _,stat in next,plr.leaderstats:GetChildren() do
                                        dat[stat.Name] = stat.Value
                                end
                        else
                                rn:Disconnect()
                        end
                end)
        end))
        plr.CharacterAdded:connect(function(char)

                local humanoid,hrp = char:FindFirstChild("Humanoid"),char:FindFirstChild("HumanoidRootPart")

                if humanoid and hrp then

                        if stage.Value ~= 0 then

                                local part = workspace.ObbyStages:FindFirstChild(stage.Value)
                                hrp.CFrame = part.CFrame + Vector3.new(0,1,0)


                        end

                end

        end)
        
        local char = plr.Character or plr.CharacterAdded:Wait()
        char = plr.Character
        local humanoid,hrp = char:FindFirstChild("Humanoid"),char:FindFirstChild("HumanoidRootPart")

        if humanoid and hrp then

                if stage.Value ~= 0 then

                        local part = workspace.ObbyStages:FindFirstChild(stage.Value)
                        hrp.CFrame = part.CFrame + Vector3.new(0,1,0)


                end

        end
        
        
        
end)

player.PlayerRemoving:connect(function(plr)
        
        local dat = Inter[plr.Name]
        if dat then
                local err = savePlrData(plr,dat)
                if err then print(err) end
        end

end)

game:BindToClose(function()

        for _,plr in pairs(player:GetPlayers()) do
                local dat = Inter[plr.Name]
                if dat then
                        local err = savePlrData(plr,dat)
                        if err then print(err) end
                end

        end

end)

The issue was CharacterAdded wasn’t firing fast enough, or we didn’t implement the event fast enough. And so, that was the issue.

Hello again!! :blush: :wink: I’m going to tell you 3 comments about your script and other things. The first thing, it did not work, I keep appearing at the beginning and in the position table the level is still four. The second thing, I discovered what is happening, or so I think, and it is that simply the checkpoints when touching them do not count the level, I just discovered it, I touched checkpoint 5 and the number in the leaderboard was changed, but the point of control was not saved, when I rebooted the character without exiting the game, it took me back to the beginning, therefore the problem is that the control point does not save your position when you touch it, even if you do not exit the game the checkpoint does not It counts as if you had touched it but if the level in the leaderboard changes. Third, I will give you two pieces of information that can help with something, the first is that the beginning is not a block with the name “1”, but the beginning is a SpawnLocation , and the second is that the levels are in a folder called ObbyStages . , and they are numbered in blocks with a numeric name, that is, they are in order: SpawnLocation, block with name “1”, block with name “2” …, block with name “10” and so on up to 250 I don’t know if that information helps but I give it to you anyway.

1 Like