Leaderstats is not a valid member of Model "Workspace.TheGameMaker178"

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

Code to change stage number
image

Code to setup leaderstats
image

I believe the error is caused because the script is looking for the character, not the player, and “leaderstats” is in the player.

You are going to need to provide us with your code, we can’t help you unless you have provided us the code.

One thing you could try is to add a :WaitForChild().

is the leaderstats folder inside the player instance or the physical player model?

Sorry I Intended to add my code and did not realize that I had not added it.

its in the Instance.

Character limit.

In your first script just do game.Players:GetPlayerFromCharacter(hit.Parent).

Make the “L” of the leaderstats lowercase.

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.

edit: I didn’t realise someone else said it sorry

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