How to make roblox understand?

I have a problem, Roblox doesn’t understand what he needs. I have 2 leaderstats with the the same name. Let’s say I have and leaderstats.value.level, well, and roblox does not understand what i mean!

2021-09-06 (2)

did you actually add a leaderstats folder/value to the player?

1 Like

What do you meen? I don’t really understand

Use :WaitForChild().
For more information: Instance | Roblox Creator Documentation

Here is example:

local Part = game.Workspace:WaitForChild("Part")

The WaitForChild basicly wait until find somthing you want from them, then run code.
Since it said: “leaderstats is not a vaild member of…etc.” It didn’t founded leaderstats in CotRobloxGame. You may use :WaitForChild(“leaderstats”) or check what’s inside of CotRobloxGame.

Leaderstats needs to be a folder within the player, as @supergreatr299 rightfully said. It can’t be a value, instance, etc, it can only be a folder with the name “leaderstats”. If you are making this folder and putting it in the player, the script accessing it may be referencing it too soon, all though that is unlikely.

Could you provide some sort of code so that we may see the issue?

1 Like

Nothing ever calls the onPlayerEntered function so you need to connect it up to an event such as:



Try something like this:


local Folder ="Folder", plr)
Folder.Name = "leaderstats"

local Cash ="IntValue", Folder)
Cash.Name = Score
Cash.Value = 0

local Seconds ="IntValue", Folder)
Seconds.Name = "Time"
Seconds.Value = 0


game.Players.PlayerAdded:connect(function(newPlayer) should help.

And i need make DataStore but dont working
DataStore script:

local ds = game:GetService(“DataStoreService”):GetDataStore(“SaveData”)
local plrkey = “id_”…plr.UserId
local save1 = plr.leaderstats.Cash
local save2 = plr.leaderstats.Time

local GetSaved = ds:GetAsync(plrkey)
if GetSaved then
	save1.Value = GetSaved[1]
	save2.Value = GetSaved[2]
	local NumberForSaving = {save1.Value}
	ds:GetAsync(plrkey, NumberForSaving)


ds:SetAsync(“id_”…plr.UserId,{plr.leaderstats.Cash.Value, plr.leaderstats.Time.Value})

Remove this part. GetAsync does not take two arguments.

1 Like

Nothing works for me, what should I do?

Thank you so much, i’ve been thinking for 4 hours.
I am bad scripter