-- Buy case #1


BuyCasesEvents.Case1.OnServerEvent:Connect(function(player, PricePoints, PriceGems, PointsBuy)
	if PointsBuy == true then
		if player.DataFolder.Points.Value >= PricePoints then
			player.DataFolder.Points.Value -= PricePoints
			print(PricePoints)
			--Transaction Completed
			player.Inventory.BatCase1.Value += 1 --Choose the case
		else
			MessagesEvents.NotEnoughPoints:FireClient(player)
		end
	elseif PointsBuy == false then
		if player.DataFolder.Gems.Value >= PriceGems then
			player.DataFolder.Gems.Value -= PriceGems
			print(PriceGems)
			--Transaction Completed
			player.Inventory.BatCase1.Value += 1 --Case
		else
			MessagesEvents.NotEnoughPoints:FireClient(player)
		end

	end
end)

OpenCasesEvents.OpenCase1.OnServerEvent:Connect(function(player)
	if player.Inventory.BatCase1.Value > 0 then
		player.Inventory.BatCase1.Value -= 1
		OpenCasesEvents.OpenCase1:FireClient(player)
	else
		MessagesEvents.CaseNotOwned:FireClient(player)
	end
end)

