Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Attempt to index nil with 'Connect'?

Error : attempt to index nil with 'Connect'

Local Script:

local BarPercent = script.Parent.Rank.Rank
local Coins = script.Parent.Coins
local Gems = script.Parent.Gems
local Rank = script.Parent.Rank.TextLabel
local plr = game.Players.LocalPlayer
local x = require(game.ReplicatedStorage.BigNum)



plr.stats.Rank.Value.Changed:Connect(function()
print("Hello World!")
end)

2 answers

You will need to wait for the object to load. Try using a WaitForChild() instead.

plr:WaitForChild("stats"):WaitForChild("Rank").Value.Changed:Connect(function()
	print("Hello World!")
end)

This isn't the best practice, but you get the point.

This discussion is preserved as it was. New answers, comments, and votes are closed.