My leaderstats isn't creating a new Intvalue

Hey, so I’m working on a system to save where you last were at in the game, but the thing is the coin system in my game is working but the lastseen leaderstat isnt loading. this is my code.

No it’s not. It’s a global function part of the Roblox standard library.

If you look at the syntax rule of Lua 5.1 (which Luau is based in), you’ll see that this is a valid syntax: Lua 5.1 Reference Manual

Here’s the list of fully reserved Luau keywords which means it cannot be used as identifiers at all (which is probably the same as Lua 5.1, otherwise it’ll break compatibility):
https://www.lua.org/manual/5.1/manual.html#2.1

still doesnt make a new intvalue for lastseen though

Any errors? You should wrap your async calls in a pcall as well.

no errors. i also havent used pcall before so idk how to do that. but ill try figuring out how to do that

Does your code even running the PlayerAdded function, and:
Does it create the rest of the stats?

yes it creates the rest of the stats but lastseen

Is this everything you’re creating inside the leaderstats folder?
There’s a limit of how many values it can display.

yes at least everything under playeradded function and i only want packoins to be visible on leaderboard

If you only want packoins to be visible, why are you parenting Lastseen to the leaderstats folder?
You can parent the Lastseen object inside the player.

ohh so ok i think i know what to do now ill tell you if it works

ok well i parented it to player but still it not making the intvalue

Show me a screenshot of your console after running the code, as well as the player’s descendants.

image


but the error is coming from a different script that i am using lastseen for but i will use findfirstchild for that

1 Like

Then use FindFirstChild if you want to keep it this way.
You are most likely using the dot operator.

And, you should just merge your scripts because it still won’t find your value since the other script is most likely checking the value before it’s created.

now its saying that i am trying to index nil
image
should i do waitforchild

Merge the scripts, your Lastseen value is created after your other script runs, which will cause an error.

ok ill see if that works thanks for all the help so far though

in roblox studio