This script worked yesterday, but when I started adding upgrades it wont work?

game.Players.PlayerAdded:connect(function(player)
	local leaderstats = Instance.new("Model",player)
	leaderstats.Name = "leaderstats"
    local money = Instance.new("IntValue", leaderstats)
	money.Name = "Money"
	money.Value = 0
function addMoney(b)
	if b.Name == "MONEYBRICK" then
		money.Value = money.Value + 5
		if game.Workspace.UPGRADE1.Touched and b.Name == "MONEYBRICK" then
		money.Value = money.Value + 5
		end
	end
end
function buyupgrade1()
	if money.Value >= 50 then
		money.Value = money.Value - 50
	c = game.Lighting.UPGRADE1:Clone()
	wait(.5)
	c.Parent = game.Workspace
	game.Workspace.pp:Destroy()
	c.Transparency = 0.7
	wait(1)
	c.Transparency = 0.5
	wait(1)
	c.Transparency = 0.3
	wait(1)
	c.Transparency = 0 
	end
end
end)
game.Workspace.pp.Touched:connect(buyupgrade1)
game.Workspace.HITPART.Touched:connect(addMoney)

Thanks.