--My script-- function PlayerEntered(newPlayer) local stats = Instance.new("IntValue") stats.Parent = newPlayer stats.Name = "leaderstats"
local currency = Instance.new("IntValue") currency.Parent = stats currency.Name = "Thiccness" currency.Value = 0 end
game.Players.ChildAdded:connect(PlayerEntered)
local datastore = game:GetService("DataStoreService"):GetDataStore("Thiccness")
game.Players.PlayerRemoving:Connect(function(leaver) datastore:SetAsync("player_"..leaver.userId,Thiccness) end)
local key = "player_"..Thiccness.UserId
local getsave = datastore:getAsync(key) Thiccness.Value = getsave
--Errors-- 17:57:19.769 - ServerScriptService.leaderstats:20: attempt to index global 'Thiccness' (a nil value)
I need help.I was trying to make an leaderstats that worked but it doesn t saved the progress.So i wrote more scripts that i find on youtube or this platform and i got all of this errors that i don t understand how to resolve.
Can someone please help me please?

2 comments
Can you show me what line 20 of the script is? I'm not sure which one to fix
local key = "player_"..Thiccness.UserId --that is line 20--