Currency script

hey i was coding but i got this error

	local ID =  "currencyName".."-"..player.UserId

What is the error? Without this we can’t help you

EDIT: As @Nerkonl posted the same question as me, i will change my question: where line?

1 Like

What’s the error?

30 charssssssssssssssssssss

it says


edit leaderstats is not a valid member of player

Ok, but the error message? Still can’t help

leaderstats is not a valid member of player

How do you have add the Folder? Via local or server (server == normal) script? If you added it via local script, then move it to server.

Do you are sure that the folder exist on the server side?

You put player.leadersats


You should put player.leaderstats[currencyName].Value

1 Like

I think that fixes your problem, if my post is the solution then please mark it as the solution.

If you can then yes, this would more help us.

leaderstats is not inside a player, the script run first before leaderstats was added.
You also got wrong spelling (You wrote “leadersats” instead of “leaderstats”)
So the solution is Wait for leaderstats to added.


Just like @Firzal_VX said use the ROBLOX built in function :WaitForChild and also fix the spelling mistake of “player.leadersats”

Try to change this name as @Nerkonl has say

Are you sure that you published the game and have enabled API access in the Game Settings?

Can you try changing this to currency.Parent = leaderstats ?

maybe that’s the problem.

if i do then the code breaks

always double check spellings.

already changed that

30 chaaahah

got a new error Money is not a valid member of Folder

First Test in game, not in Studio, then if it still don’t work so try this:

local succes, Data = pcall(function() 
    return savedData = DateStore:GetAsync(ID) 
if succes then 
    if Data then
        currency.Value = data
        print("Data loaded") 
    else --new player 
        currency.Value= 50 
        print("New player to the game") 

P.S.: its the Value you change not the name, so not currency.Name = 50, but currency.Value = 50
This should help you with the Money error