Log in to vote

why is there an erroe here i saw hedevking video and not coming?

Asked by 3 days ago

local DataStoreService = game:GetService("DataStoreService") local MyDataStore = DataStoreService:GetDataStore("MyDataStore")

game.Players.PlayerAdded:Connect(function(Player) local leaderstats ="Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = Player

local Points ="IntValue")
Points.Name = "Points"
Points.Parent = leaderstats

local playerUserId = "Player_"..player.UserId

local data
local succes, errormessage = pcall(function()
     data = MyDataStore:GetAsync(playerUserId)

if succes then
    Points.Value = data
    --set our data to equal points


end) after the local playeruserid there is player.userid that player is in a blue line when i play it its saying this ServerScriptService.server script:13: attempt to index nil with 'UserId' - Server - server script:13

1 answer

Log in to vote
Answered by
Xapelize 1835 Moderation Voter
3 days ago
Edited 3 days ago


wrong capitalization, should be Player not player (in your script line 13)

Some notes:

why is that called playerUserId, key will make more sense, but you dont need to change, it's working
it's thedevking not hedevking lol
"it's thedevking not hedevking lol" i completely agree Nozazxe 68 — 2d
thanks for answering and i have another doubt which you ca see ncihxad1123 12 — 1d

Answer this question