Checkpoint only working for R15 players, not R6?

Heya, so something really confusing to me… I am coding a simple checkpoint system for my roblox game I am working on. I tested the checkpoints in R15 and they worked perfectly, now in R6 they do absolutely nothing. They don’t even put an error in the console, I switched back to R15 to confirm the bug and it’s still there.

If anyone can help, that would be great. If not please like this so more people can!

Code:

local checkpoints = workspace.checkpoints

local datastore = game:GetService("DataStoreService"):GetDataStore("Stage")

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

	local stage = Instance.new("IntValue")
	stage.Value = datastore:GetAsync(player.UserId, stage.Value) or 1
	stage.Name = "Stage"
	stage.Parent = leaderstats

	player.CharacterAdded:Connect(function(character)
		local humanoid = character:WaitForChild("Humanoid")

		wait(character:MoveTo(checkpoints[stage.Value].Position))
		character:MoveTo(checkpoints[stage.Value].Position)

		humanoid.Touched:Connect(function(part)
			if part.Parent == checkpoints then
				if tonumber(part.Name) == stage.Value + 1 then
					stage.Value = stage.Value + 1
				end
			end
		end)
	end)
end)

game.Players.PlayerRemoving:Connect(function(player)
	local success, errormessage = pcall(function()
		datastore:SetAsync(player.UserId, player.leaderstats.Stage.Value)
	end)
	if success then
		print("saved stage for " .. player.Name)
	else
		warn(errormessage)
	end
end)

game.Chat.BubbleChatEnabled = true
game.Players.RespawnTime = 0

Layout of the folder:
image

:sparkling_heart: Thanks for reading this, and especially if you know how to fix it!

2 Likes

You can probably try doing humanoid:MoveTo() instead of character:MoveTo().

That makes the humanoid attempt to walk to the position not teleport to it.

I will need that for a seperate thing, thought it’s the leaderstat not going up. the ui works.

Why don’t you set the HumanoidRootPart CFrame to the checkpoint CFrame then.

what do you mean by this? for the leaderstat?

I see the problem with the leader stats You are just making a model and parenting to the player

How can i fix this? Since it works fine in r15.

Don’t parent the model to the character? Or just try positioning the HumanoidRootPart instead.

In the game settings try changing the avatar type to R6 and change the animation to standard then see if works

I don’t suggest this unless he wants the game to look old and boring. Just remove the model from the character that you parented to it or position the HumanoidRootPart instead.

Also instead of creating a model for the leaderstats try using a folder

This is just changing the leaderstat’s to a folder, which works. But i need to figure out why it’s only adding the stage +1 if you touch the part in r15 only.

HumanoidRootPart does not work either.

wait(character:MoveTo(checkpoints[stage.Value].Position))
		character:MoveTo(checkpoints[stage.Value].Position)

I see a error in those 2 lines instead of using move to trying using cframing the humanoid root part

also when you touch the checkpoint send a full picture of your output

This part is for the GUI to press arrows to get to a stage, that works already. I just need to figure out why it only works in r15.

send the output when u click it in r15

Now it has stopped working in R15 as well.

(nothing in output, didn’t realise u can’t see)

R6 does not have a HumanoidRootPart, so when you try to move the Character to a checkpoint, the Character will stay in the same spot, even though you see the Character moving. You need to manually move the R6 character to the checkpoint using the Character’s Torso.