How can I update these scripts

But remember that the main thing is to solve the problem that some players have their level reset, I’m going to try it and let you know :frowning:

Yes, but, I think that the thing making it go x2.

the script is not missing the

local obbyStages = workspace:WaitForChild(“ObbyStages”) ?

Put that back, must have not copyed it :confused:

este es el mismo guion que tengo desde el principio :no_mouth:

this is the same script that i have from the beginning

I know that, But what I did messed it up more, so, I want to take more of a beter look at th script, can we team create?

SORRY SORRY I SAID IT IN SPANISH, IT IS THAT MY LANGUAGE IS SPANISH AND I FORGOT THAT I WAS TALKING TO SOMEONE WHO SPEAKS ENGLISH :frowning:

It ok, I used google translate. lol, can we taem create?

ok, but I don’t know how to create a team, since I work alone. How is it done?

Sorry for this request, but could you provide a reproducible rbxm or rbxl version of your issue? I need to see what you are experiencing so that I can fix it. It doesn’t have to be the actual game itself, I just need a reproducible version.

Go to the view tab on the top, then click “Team test”. It will pop up, then click Turn On. It will reload you into the game with team test on. Then you go to settings, then to permissions in settings. Then type my username “Dan_foodz” in the permissions box, when I pop up, clcik on me. then when I get added, set my permission to edit.

do you want a video of the problem? If so, I don’t have one as it’s simply players complaining about their level being reset and they go back to the start

tell me when you turned on team create.

ok, i think i’m already doing it, i already gave her your name

What do you mean. Also I still can’t get in.

Okay so,

  1. Remove the wait(2) in

That doesn’t really do anything, the thing that when the server closes does is that it actually waits for the thread to finish all of it’s tasks when you bind it to close, however it waits only for a maximum of 30 seconds before closing the server. If your stuff is already completed within that time, it will close.


Let’s fix this.

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

  1. Updating your data script. (Script Two)
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)

WARNING! This will most likely reset data when you first change it when you publish the game with these changes.

What is this? I can go into the game.

can you edit that game??? :no_mouth: :wave: :wink: :wink: :wave: