Error : attempt to index nil with 'Connect'
Local Script:
01 | local BarPercent = script.Parent.Rank.Rank |
02 | local Coins = script.Parent.Coins |
03 | local Gems = script.Parent.Gems |
04 | local Rank = script.Parent.Rank.TextLabel |
05 | local plr = game.Players.LocalPlayer |
06 | local x = require(game.ReplicatedStorage.BigNum) |
07 |
08 |
09 |
10 | plr.stats.Rank.Value.Changed:Connect( function () |
11 | print ( "Hello World!" ) |
12 | end ) |
I think you meant:
1 | plr:WaitForChild( "stats" ).Rank:GetPropertyChangedSignal( 'Value' ):Connect( function () |
2 | print ( "Hello World!" ) |
3 | end ) |
Use GetPropertyChangedSignal
https://developer.roblox.com/en-us/api-reference/function/Instance/GetPropertyChangedSignal
Properties have no events
Used WaitForChild in case it takes a while to load
Edit: Have no idea why a few letters of the code is cut out...
You will need to wait for the object to load. Try using a WaitForChild() instead.
1 | plr:WaitForChild( "stats" ):WaitForChild( "Rank" ).Value.Changed:Connect( function () |
2 | print ( "Hello World!" ) |
3 | end ) |
This isn't the best practice, but you get the point.