local Player = game.Players.LocalPlayer
local Points = Player.leaderstats.Points
script.Parent.Text = "Points: " .. Points.Value
Points:GetPropertyChangedSignal("Value"):Connect(function()
script.Parent.Text = "Points: " .. Points.Value
end)
✓ ANSWER ACCEPTED
need help on what this means ServerScriptService.Script:3: attempt to index nil with 'leaderstats'?
2 answers
✓ Accepted answer
Make sure that you're creating the "leaderstats" object within the player before you try to reference it, as it's not a default object / property within a Player.
local Player = game.Players.LocalPlayer
local leaderstats = Instance.new("Folder") -- creates the new "leaderstats" folder
leaderstats.Name = "leaderstats"
leaderstats.Parent = Player
local Points = Instance.new("NumberValue") -- creates the new "Points" value
Points.Name = "Points"
Points.Parent = leaderstats
script.Parent.Text = "Points: " .. Points.Value
Points:GetPropertyChangedSignal("Value"):Connect(function()
script.Parent.Text = "Points: " .. Points.Value
end)
local Player = game.Players.LocalPlayer
local a,b = Instance.new("Folder"),Instance.new("NumberValue")
a.Parent,b.Parent,a.Name,b.Name,b.Value = player,a,"leaderstats","Points",0
script.Parent.Text = "Points: "..b.Value
b:GetPropertyChangedSignal("Value"):Connect(function()
script.Parent.Text = "Points: "..b.Value
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
you forgot to name it
oop