Basically I’m making a checkpoint system that changes the stage number whenever you touch the checkpoint but, I’m getting this error thrown at me whenever I run it, even though My character is the parent of the leaderstats folder
hit.Parent gets the character, you need to get the player. As @kwkxbxkdkdjjd said, game.Players:GetPlayerFromCharacter(hit.Parent) should do the trick, and as @awry_y said, the L of leaderstats shouldn’t be uppercase.
There are 2 errors in the code.
1: You are looking in the character for leaderstats, however the leaderstats are located in the player instance. Use game.Players:GetPlayerFromCharacter(hit.Parent) as the player instance.
2: Leaderstats is spelt fully in lowercase, you have used Leaderstats.Stage, where it should be leaderstats.Stage. Remember Lua is case sensitive.