How can i Reset the Checkpoint?

SpawnPointScript is First Script
TouchHandler is Second Script

Delete TouchHandler script which is in the Checkpoints folder and insert a new script in ServerScriptService. Paste this script into it.

Checkpoints klasörünün içindeki TouchHandler’ı sil ve ServerScriptService'e bir kod bloğu açıp bu kodu onun içine yerleştir.

Tutorial1

for i, v in pairs (game.Workspace.Checkpoints:GetChildren()) do
	if v:IsA("BasePart") then
		v.Touched:Connect(function(hit)
			
			local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
			
			if player then
				if (tonumber(Checkpoint.Value + 1)) == tonumber(v.Name) then
					Checkpoint.Value = tonumber(v.Name)
				end
			else
				return false
			end
		end)
	end
end

Well i disabled TouchHandler and i insert a new Script in a ServerScriptService,


and copy paste this code and i launched and we have and error says:image

game.Players.PlayerAdded:Connect(function(player)
    local leaderstats = Instance.new("Folder", player)
    leaderstats.Name = "leaderstats"

    local Checkpoint = Instance.new("IntValue", leaderstats)
    Checkpoint.Name = "Checkpoint"
    Checkpoint.Value = 1

    repeat
	    wait()
    until player.CharacterAdded

    for i, v in pairs (game.Workspace.Checkpoints:GetChildren()) do
	    if v:IsA("BasePart") then
		    v.Touched:Connect(function(hit)
			
			    local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
			
			    if player then
				    if (tonumber(Checkpoint.Value + 1)) == tonumber(v.Name) then
					    Checkpoint.Value = tonumber(v.Name)
				    end
			    else
				    return false
			    end
		    end)
	    end
    end
end)

Okay try this one and don’t define any variable. It’ll work now.

Bunu SpawnPointScript’e koy çünkü az önce kendime göre yapmıştım. :sweat_smile: O yüzden çalışmamış olabilir. local Checkpoint yazmışsın. Oradaki kastım Checkpoints klasörü değildi, oyuncunun klasöründeki değerdi. O yüzden checkpoint diye bir değişken atadığın için çalışmadı. Şimdi buna hiçbir şey yazmadan koyabilirsin. Eminim şimdi çalışacaktır.

Should i delete everything inside in SpawnPointScript ?

Eğer SpawnPointScript’in içindeki sadece yukarıdaki gibiyse onu silip aşağıdakini ekle.

game.Players.PlayerAdded:Connect(function(player)
    local leaderstats = Instance.new("Folder", player)
    leaderstats.Name = "leaderstats"

    local Checkpoint = Instance.new("IntValue", leaderstats)
    Checkpoint.Name = "Checkpoint"
    Checkpoint.Value = 1

    repeat
        wait()
    until player.CharacterAdded

    player.CharacterAdded:Connect(function(Character)
	    repeat wait() until player.Character ~= nil
	    local checkpoint = game.Workspace.Checkpoints:FindFirstChild(Checkpoint.Value)
	    Character:WaitForChild("HumanoidRootPart").CFrame = CFrame.new(checkpoint.Position + Vector3.new(0,2,0))
    end)

    for i, v in pairs (game.Workspace.Checkpoints:GetChildren()) do
        if v:IsA("BasePart") then
	        v.Touched:Connect(function(hit)
		
		        local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
		
		        if player then
			        if (tonumber(Checkpoint.Value + 1)) == tonumber(v.Name) then
				        Checkpoint.Value = tonumber(v.Name)
			        end
		        else
			        return false
		        end
	        end)
        end
    end
end)

It doesnt work either, i recorded some vids you can see what happens and i cant

Okey im uploading to youtube so you can see whats the problem

Here you go.

No no no thats not what im talking about, its just checkpoint i want to make if spesific event fires and resets checkpoint who touched this event

game.Players.PlayerAdded:Connect(function(player)
    local leaderstats = Instance.new("Folder", player)
    leaderstats.Name = "leaderstats"

    local Checkpoint = Instance.new("IntValue", leaderstats)
    Checkpoint.Name = "Checkpoint"
    Checkpoint.Value = 1

    repeat
        wait()
    until player.CharacterAdded
    
    local part = game.Workspace.Part

    part.Touched:Connect(function(hit)

        local checkPlayer = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
        if checkPlayer then
            Checkpoint.Value = 0
        end
    end)
end)

Finally i uploaded the video

What is the Part i dont get it

I think you are using a script under the part because when I checked in the studio there was no problem. I think you should check if there is a Script under the part. It must have affected your value.

Can you explain a little bit because i dont understand, in your video its just Checkpoint, i want to reset the checkpoint

CellatBaba modelinin altında kod bloğu olabilir mi? Değeri 0 yapan bir kod olmalı. Böyle bir kod olabilir mi?

script.Parent.Touched:Connect(function()
    player.leaderstats.Checkpoint.Value = 0
end)

Böyle bir şey varsa sil.

No i made CellatBaba xd from 0 animation face clothing all of these stuff. So Cellat doesnt have any code like that, but i have this code in my other script

wait()
local dum = game.Workspace.CellatBaba
local players = game:GetService("Players")
local lead = game.Players:WaitForChild("leaderstats", 1)

game.Workspace.CellatBaba.Hitbox.Touched:Connect(function(hit)
	local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
	if game.Players:GetPlayerFromCharacter(hit.Parent) then
		game.Workspace.CellatBaba:SetPrimaryPartCFrame(CFrame.new(0,0,0))
		hit.Parent.Humanoid.Health = 0 
		Player.leaderstats.Checkpoint.Value = 0
		
	end 	    
end)	

its a local script in StarterGui maybe this code cause that problem

Okay the reason it is going down to 0 is this line. Delete it. :laughing:

But the main purpose of cellat that is when cellat catchs you your all checkpoints are resets