Anyone know why it says UserID is not a valid member of Player "Players.Bl_nkDev"

  1. What do you want to achieve? to make the script work
  2. What is the issue? I have 0 clue I have read the script 3-4 times and I’m still new to scripting.
  3. What solutions have you tried so far? not much

Here is the script:
local function setupPlayerData(player: player)
local userID = player.UserID
local key = “Player_”…userID

local leaderstats = Instance.new("Folder", player)
leaderstats.Name = "leaderstats"

local food = Instance.new("IntValue", leaderstats)
food.Name = "Food"
food.Value = 0

local coins = Instance.new("IntValue", leaderstats)
coins.Name = "Coins"
coins.Value = 0

local success, returnValue
success, returnValue = pcall(dataStore.GetAsync, dataStore, key)
print(returnValue)

The attribute is called UserId and not UserID, for your information. It is case-sensitive.

2 Likes

I changed it and now it says:

ServerScriptService.Player data:17: attempt to concatenate string with nil

Concatenation isn’t three dots like local key = “Player_”…userID, it should be two dots to operate it. I can’t see the complete code anyway. What has changed?

post another post about this error and mark the above awnser as the solution, because this isnt related to the original error of you replacing Id with ID.

1 Like

sorry still new to all this, thank you for telling me.

1 Like

no problem!

MEDIC GAMING! (need more characters)

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