Pet Module Error

I am currently testing my module script at the moment. I am trying to get a simple pet system down. The problem is, is that it says I dont have enough money for the egg, but it still equips it. (or just parents to the workspace for now)

local TweenService = game:GetService('TweenService')
local petModels = game:GetService('ReplicatedStorage'):WaitForChild('Pets')
local petsListModule = require(script.Parent.PetsList)

local module = {}

function module.HatchEgg(plr, cost)
	if plr.leaderstats.Money.Value >= cost then
		return true
	else 
		return false
	end
end

function module.EquipPet(plr, pet)
	local petModel = petModels[pet]:Clone()
	
	if petModel then
		petModel.Parent = workspace
	end
end

function module.SetupEgg(eggName)
	local eggModel = eggName:FindFirstChild('Mesh')
	local cost = eggModel:WaitForChild('Cost').Value
	
	local proximtyPrompt = Instance.new('ProximityPrompt')
	proximtyPrompt.Name = 'Prompt'
	proximtyPrompt.HoldDuration = 0.2
	proximtyPrompt.ObjectText = "$".. tostring(cost)
	proximtyPrompt.ActionText = 'Hatch'
	proximtyPrompt.Parent = eggModel
	
	proximtyPrompt.Triggered:Connect(function(plr)
		module.HatchEgg(plr, cost)
		wait(2)
		local result = module.EquipPet(plr,  petsListModule.WaterEgg.Monster)
		if result == true then
			module.EquipPet(plr, petsListModule.WaterEgg.Monster)
		else
			print("[Module] - Cant equip because you have no money!")
		end
	end)
	
	return proximtyPrompt
end

return module

can you trying printing the Money’s value and try printing the cost

My value is zero and the cost of the egg is 200.

I see, your still calling the equip pet function. What you really should be doing is checking the result of the HatchEgg function. Why your previous thing didnt work because EquipPet was being called to get the result of it and equips the pet.

proximtyPrompt.Triggered:Connect(function(plr)
		local result = module.HatchEgg(plr, cost)
		wait(2)
		if result == true then
			module.EquipPet(plr, petsListModule.WaterEgg.Monster)
		else
			print("[Module] - Cant equip because you have no money!")
		end
	end)