1 | local Player = game.Players.LocalPlayer |
2 |
3 | local Points = Player.leaderstats.Points |
4 |
5 | script.Parent.Text = "Points: " .. Points.Value |
6 |
7 | Points:GetPropertyChangedSignal( "Value" ):Connect( function () |
8 | script.Parent.Text = "Points: " .. Points.Value |
9 | end ) |
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.
01 | local Player = game.Players.LocalPlayer |
02 |
03 | local leaderstats = Instance.new( "Folder" ) -- creates the new "leaderstats" folder |
04 | leaderstats.Name = "leaderstats" |
05 | leaderstats.Parent = Player |
06 |
07 | local Points = Instance.new( "NumberValue" ) -- creates the new "Points" value |
08 | Points.Name = "Points" |
09 | Points.Parent = leaderstats |
10 |
11 | script.Parent.Text = "Points: " .. Points.Value |
12 |
13 | Points:GetPropertyChangedSignal( "Value" ):Connect( function () |
14 | script.Parent.Text = "Points: " .. Points.Value |
15 | end ) |
01 | local Player = game.Players.LocalPlayer |
02 |
03 | local a,b = Instance.new( "Folder" ),Instance.new( "NumberValue" ) |
04 | a.Parent,b.Parent,a.Name,b.Name,b.Value = player,a, "leaderstats" , "Points" , 0 |
05 |
06 | script.Parent.Text = "Points: " ..b.Value |
07 |
08 | b:GetPropertyChangedSignal( "Value" ):Connect( function () |
09 | script.Parent.Text = "Points: " ..b.Value |
10 | end ) |