Attempt to index nil with 'WaitForChild' whilst using topbarplus

Hello, I want to make a script that uses TopbarPlus to display the players money. I’ve mocked up a script and now when ever I play the game, I get an error from TopbarPlus saying

ReplicatedStorage.TopbarPlus.Icon:79: attempt to index nil with 'WaitForChild' - Server - Icon:79

If I remove my script I made, TopbarPlus doesn’t error so I’m pretty certain it is my script as I’ve also reinstalled TopbarPlus and it didn’t fix it.

My script:

local TopbarPlus = require(game:GetService("ReplicatedStorage").TopbarPlus.Icon)
local moneyLabel = TopbarPlus:setLabel("")

local function updateMoney(player)
	local playerStats = player:FindFirstChild("leaderstats")
	if playerStats then
		local playerMoney = playerStats:FindFirstChild("Money")
		if playerMoney then
			local topbar = TopbarPlus:GetTopbar(player)
			if topbar then
				if moneyLabel then
					moneyLabel:setLabel("Money: " .. playerMoney.Value)
				end
			end
		end
	end
end

game.Players.PlayerAdded:Connect(function(player)
	local playerStats = player:FindFirstChild("leaderstats")
	
	TopbarPlus:CreateTopbar(player)

	moneyLabel:SetLabel("$" .. tostring(playerStats.Gold.Value)) 

	updateMoney(player)

	local playerStats = player:WaitForChild("leaderstats")
	local playerMoney = playerStats:WaitForChild("Money")
	playerMoney.Changed:Connect(function()
		updateMoney(player)
	end)
end)

I’m quite new to TopbarPlus so I’m not even sure if what I’m trying to do is possible but im giving it a shot.

Could you show the TopbarPlus module line that it is warning you on?

Yeah sorry I should have added this

local playerGui = localPlayer:WaitForChild("PlayerGui")