local Player = game.Players.LocalPlayer local BagText = script.Parent.BagLabel local CoinText = script.Parent.CoinLabel local ReplicatedStorage = game:GetService("ReplicatedStorage") local RemoteEvents = ReplicatedStorage.RemoteEvents BagText.Text = "Bag: " .. Player.PlayerStats.CurrentValue.Value .. "/" .. Player.PlayerStats.Storage.Value CoinText.Text = "Coins: " .. Player.PlayerStats.Coins.Value Player.PlayerStats.CurrentValue:GetPropertyChangedSignal("Value"):Connect(function() BagText.Text = "Bag: " .. Player.PlayerStats.CurrentValue.Value .. "/" .. Player.PlayerStats.Storage.Value end) Player.PlayerStats.Coins:GetPropertyChangedSignal("Value"):Connect(function() CoinText.Text = "Coins: " .. Player.PlayerStats.Coins.Value end)
Your LocalScript is most likely running too early for the PlayerStats to be created, and as a result, it is not parented under the player yet.
By adding a local variable pertaining to the "PlayerStats" and using "WaitForChild()" you can make sure that the functions are only able to be run when "PlayerStats" is a member of the player.
local Player = game.Players.LocalPlayer local Stats = Player:WaitForChild("PlayerStats") local BagText = script.Parent.BagLabel local CoinText = script.Parent.CoinLabel local ReplicatedStorage = game:GetService("ReplicatedStorage") local RemoteEvents = ReplicatedStorage.RemoteEvents BagText.Text = ("Bag: "..Stats.CurrentValue.Value.."/"..Stats.Storage.Value) CoinText.Text = ("Coins: "..Stats.Coins.Value) Stats.CurrentValue:GetPropertyChangedSignal("Value"):Connect(function() BagText.Text = ("Bag: "..Stats.CurrentValue.Value.."/"..Stats.Storage.Value) end) Stats.Coins:GetPropertyChangedSignal("Value"):Connect(function() CoinText.Text = ("Coins: "..Stats.Coins.Value) end)
In order to be extra sure, you can do the same for the values inside the function
local Player = game.Players.LocalPlayer local Stats = Player:WaitForChild("PlayerStats") local Current = Stats:WaitForChild("CurrentValue") local Storage = Stats:WaitForChild("Storage") local Coins = Stats:WaitForChild("Coins") local BagText = script.Parent.BagLabel local CoinText = script.Parent.CoinLabel local ReplicatedStorage = game:GetService("ReplicatedStorage") local RemoteEvents = ReplicatedStorage.RemoteEvents BagText.Text = ("Bag: "..Current.Value.."/"..Storage.Value) CoinText.Text = ("Coins: "..Coins.Value) Current:GetPropertyChangedSignal("Value"):Connect(function() BagText.Text = ("Bag: "..Current.Value.."/"..Storage.Value) end) Coins:GetPropertyChangedSignal("Value"):Connect(function() CoinText.Text = ("Coins: "..Coins.Value) end)