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 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.
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.
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