Leaderboard Scripting Guide Help

Unfortunately there’s a new issue with the checkpoints :sob:
so I tested in game with my boyfriend (not in studio test) and we discovered that the checkpoints only work if there’s 1 player in the server, otherwise one of us will pass checkpoints but then end back at the start after dying. If one of us leaves the server, it works. I have no idea how I’m supposed to fix this or how this even happened, I’m baffled.

So I looked back at the scripts and script analysis in studio and it says there was a syntax error with ‘then’ after the Checkpoint Debounce in the script that I have under each checkpoint

This was the exact error shown in script analysis for each script:
image

I have the checkpoints in a folder together with each checkpoint named after their corresponding level and then the script is under each of the checkpoints

Okay it’s been a while but I finally fixed everything! I scrapped all of the scripts in this topic pretty much and started over to create a successful checkpoint & leaderboard system.

I started by having each of my checkpoint spawns renamed according to their stage number and placed them in a folder called ‘Checkpoints’:
image

After that I found this model from a different topic (THANK YOU @Ihaveash0rtname :pray:) and used the ServerScriptService script from that to have a leaderboard.

For the actual checkpoint system I used the basic checkpoint script in all of the spawn points:

local spawn = script.Parent
spawn.Touched:connect(function(hit)
	if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		local checkpointData = game.ServerStorage:FindFirstChild("CheckpointData")
		if not checkpointData then
			checkpointData = Instance.new("Model", game.ServerStorage)
			checkpointData.Name = "CheckpointData"
		end

		local checkpoint = checkpointData:FindFirstChild(tostring(player.userId))
		if not checkpoint then
			checkpoint = Instance.new("ObjectValue", checkpointData)
			checkpoint.Name = tostring(player.userId)

			player.CharacterAdded:connect(function(character)
				wait()
				character:WaitForChild("HumanoidRootPart").CFrame = game.ServerStorage.CheckpointData[tostring(player.userId)].Value.CFrame + Vector3.new(0, 4, 0)
			end)
		end

		checkpoint.Value = spawn
	end
end)

At first I had trouble getting the leaderboard to show up but I solved it later by deleting a script I had in StarterPlayerScripts that was supposed to hide the leaderboard while the loading screen was being shown, except it didn’t work and was hiding the leaderboard the whole time.

Anyway, thank you to everyone who tried to help, I really did learn a lot from creating this topic <3

1 Like

Finally someone had use for it, I would recommend using a datastore module such as ProfileService which allows for easy access to setting it up and stopping issues such as datalose.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.