Datastore error

Hey, I am trying to make a point system but I get an error with the Datastore.

Error: image

Script:

local DataStoreService = game:GetService("DataStoreService")
local PointsStore = DataStoreService:GetDataStore("PointSave")

game.Players.PlayerAdded:Connect(function(Player)
	local SavedPoints = PointsStore:GetAsync(Player.UserId)
	
	local Leaderstats = Instance.new("Folder", Player)
	Leaderstats.Name = "leaderstats"
	
	local PointsValue = Instance.new("IntValue", Leaderstats)
	PointsValue.Name = "Points"
	
	if SavedPoints ~= nil then
		PointsValue.Value = SavedPoints
	end
	
	PointsValue.Changed:Connect(function(NewPoints)
		PointsStore:SetAsync(Player.UserId, NewPoints)
	end)
end)

It gives a point when you give a tool using a GUI, the script connected to that is:

game.ReplicatedStorage.GivePlayerItem.OnServerEvent:Connect(function(Player, PlayerName)
	if Player.Name ~= PlayerName then
		local ToolToGive = Player.Character:FindFirstChildWhichIsA("Tool")
		ToolToGive.Parent = game.Players[PlayerName].Backpack
		Player.leaderstats.Points.Value = Player.leaderstats.Points.Value + 1
	end
end)

I hope anyone can help me, already thanks! :smiley:

Add a wait for child as points haven’t loaded in yet

--Change this
Player.leaderstats.Points.Value = Player.leaderstats.Points.Value + 1
--To this
local Points = Player:WaitForChild("leaderstats"):WairForChild("Points")
Points.Value = Points.Value + 1-- OR Points.Value +=1 -- I think is new feature

I get this error now: image

Whoops I did a spelling error

WairForChild
--should be 
WaitForChild

Alright did that now, I now get this error:

Also, for some people it doesn’t show a number, it only shows ‘-’
image

Can you show your explore tab and how your Points and leader stats are parented in the player.

Sure,
image

Not that but the when you run a game, Show your Players->player->Leaderstats->Points

Ohh,