Leaderboard not displaying IntValue

I’m trying to code a checkpoint system. The code is supposed to create a leaderboard with a column display what stage the player is on and, when respawning, teleport the player to the corresponding part in the folder “Stages”

local stages = game.Workspace.Stages

game.Players.PlayerAdded:Connect(function(player)
	local folder = Instance.new("Folder", player)
	folder.Name = "Leaderstats"
	
	local stage = Instance.new("IntValue",folder)
	stage.Name = "Points"
	stage.Value = 1

	player.CharacterAdded:Connect(function(char)
		local hum = char:WaitForChild("Humanoid")
		wait()
		char:MoveTo(stages[stage.Value].position)
		hum.Touched:Connect(function(hit)
			if hit.Parent == stages then
				if tonumber(hit.Name) == stage.Value +1 then
					stage.Value = stage.Value + 1
				end
			end
		end)
	end)
end)

The code itself seems to work. The stages and spawning works as intended. The issue, though, is that I can’t see the stage value on the leaderboard. The leaderboard only displays the players name.

the leaderstats folder should be spelled with all lowercase i think

(this part should be “leaderstats” not “Leaderstats”)

2 Likes

The Roblox coding language is case-sensitive meaning that, in this situation and other situations, you need to write the leaderstats folder with a lowercase as @AMisspelledUsernaem has already mentioned.

EDIT: For example we write

while task.wait() do

Instead of

While task.wait() do
1 Like

Ah, thank you! That worked perfectly.

I had this same issue too, I spent something like 30 minutes trying to figure out the solution and then I thought:
What if I put it all lowercase?
It worked

Yes. Keep in mind that the Roblox coding language (and many others) is case-sensitive meaning that keywords, variables, function names, etc must always be typed with a consistent capitalization of letters as I have already mentioned in my previous post.

For example, we write

for i, v in pairs(myTable) do

Instead of

For i, v in pairs(myTable) do
1 Like

The only thing I don’t understand is why “leaderstats” can’t be “Leaderstats”, which is strange if you ask me, but the rest makes completely makes sense

1 Like

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