How to make the character spawn at the right checkpoint

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Im making an obby and what i want is a the player to spawn at the checkpoint if they had touched it.
  2. What is the issue? Include screenshots / videos if possible!
    Sometimes it would spawn them back at the start.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve tried to change the location of them thinking that would work, but it now seems to happen on any checkpoint where it would be rare to spawn at the start thus losing all progress.
    So if anyone knows how to fix it reply!
    Thanks for reading!
    EDIT: i am using default spawn points!

uh what…i dont understand (im new to scripting and dont yet understand XD)

Here is how I made a checkpoint System, First organize your files like this:
I named the checkpoints a number so if you clone a checkpoint name it 2, next one is 3 and so on.

Inside of the checkpoint put this in a script:

	local hum = hit.Parent:FindFirstChild("Humanoid")
	if hum then
		local player = game.Players:FindFirstChild(hum.Parent.Name)
		if player then
			local stats = player:FindFirstChild("leaderstats")
			if stats then
				local checkp = stats:FindFirstChild("Checkpoint")
				if checkp then
					if checkp.Value == (script.Parent.Name - 1) then
						checkp.Value = checkp.Value + 1

Then in leaderboard do this:

    local leaderstats ="Model")
    leaderstats.Name = "leaderstats"
    leaderstats.Parent = player

	local Checkpoint ="IntValue")
    Checkpoint.Name = "Checkpoint"
    Checkpoint.Parent = leaderstats

Finally you need a script that checks where the player needs to spawn, and for that make a script here:image

And put this code in the script:

local char = script.Parent

local player = game.Players:FindFirstChild(char.Name)

repeat wait() until player.leaderstats
repeat wait() until player.leaderstats.Checkpoint

local findspawn = game.Workspace.SpawnSystem.Checkpoints:FindFirstChild(player.leaderstats.Checkpoint.Value)

if findspawn ~= nil then
	char.Torso.CFrame = findspawn.CFrame *,5,0)

Why not you use teams and spawns for the checkpoints? It is a lot more simpler

2 Methods I can think of:

Create a leaderstat that changes when the next checkpoint is touched, and set the player’s spawnlocation to the checkpoint number. (Harder than method 2 but takes less time)

Create teams and set the player to a new team for every spawn touched. (Easier but weaker against exploiters)

Also check this out

1 Like

I dont want the teams showing up on the side, there are alot of levels

Thanks for such a detailed response i got it working. Thank You

1 Like

Ok so i found this…sometimes i would spawn at the start even after being at checkpoint 4 (not supposed to happen) and also the leaderstats wouldn’t always show up im not sure why, but if i rejoin it appears again!?
Edit i have added 30 checkpoints so maybe that broke something i dont know

Use teams instead and make sure that “Neutral” is false and “AllowTeamChangeOnTouch” is enabled.
Then, when the player touches the spawnlocation, they are automatically teamed to the team colour that they touched and when they die they re-spawn back at the last spawnlocation the player touched.

robloxapp-20200814-0854485.wmv (5.4 MB)

Quality is not the best…

hello, ah as i said in a previous reply

So adding teams would be a mess to the side

You don’t have to have the teams showing on the side. If you watch my video you can see that there are no teams showing on the playerlist.

Is there a way to hide them? if there is i will consider them.

They are already hidden, watch the video.

i have watched it, did you hide it or was it already hidden?

Teams are automatically hidden unless you insert a team module into the teams folder.

I have not included any team modules just spawn locations.

ok ill see how it goes

Ah i forgot to mention why i didn’t want teams i also want leaderstats showing what level you are up to, can you add them to the teams?

I dont understand what you mean. Are you wanting players to be able to see what level other players are?


If you want other players to see what part of the obby players are on then you could just add team modules and number them in sync with the spawn locations, this will then however show up on the player list which you don’t want it to do so.